Hi all,
I change my view as below but, show no Form...
from django.shortcuts import render_to_response
from django import forms
from yenicrm.musteri.models import *
from yenicrm.ziyaret.models import *
from django.contrib.auth.decorators import login_required
from django.template import Context, RequestContext
from django.http import HttpResponse
@login_required
def index(request):
ziyaretler = Ziyaret.objects.filter(temsilci = request.user)
return render_to_response('ziyaret.html', {'ziyaretler': ziyaretler})
@login_required
def ziyaret_ekle(request):
if request.POST:
zform = ZiyaretForm(request.POST, temsilci = request.user)
if form.is_valid():
yeni_ziyaret_objesi = form.save(commit = False)
yeni_ziyaret_objesi.temsilci = request.user
yeni_ziyaret_objesi.save()
return HttpResponse("Veritabanina kaydedildi. Yeni
ziyaretin id'si : %d" % yeni_ziyaret_objesi.pk)
return render_to_response('ziyaret_kaydet.html', {'zform':
ZiyaretForm(temsilci = request.user)},
context_instance=RequestContext(request))
2010/4/3 Daniel Roseman <[email protected]>:
> On Apr 3, 10:09 am, H.İbrahim Yılmaz <[email protected]> wrote:
>> Any help please?
>
> Bill gave you the answer two messages ago:
>
>> > 02 Nisan 2010 20:43 tarihinde Bill Freeman <[email protected]> yazdý:
>> >> You are discarding the result of your first render_to_response and
>> >> displaying
>> >> the second, which is always an empty form (except when the form is valid,
>> >> when you are returning an HttpResponse. You probably meant to put a
>> >> return in front of that render_to_response as well.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
http://www.arkeoloji.web.tr
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.