Hi, I use simply {{zform.as_table}} for rendering my form... Thanks.
02 Nisan 2010 20:43 tarihinde Bill Freeman <ke1g...@gmail.com> 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. But there could also be > problems in your template, which you have not shown. > > On Fri, Apr 2, 2010 at 12:04 PM, H.İbrahim Yılmaz <prehisto...@gmail.com> > wrote: >> Hi all, >> Thanks it works! But, i have another question about my view. When i >> use my view (as seen below) i can't get see the form. >> Thanks! >> >> @login_required >> def ziyaret_ekle(request): >> if request.POST: >> zform = ZiyaretForm(request.POST) >> 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) >> else: >> render_to_response('ziyaret_kaydet.html', {'zform': >> zform}, context_instance=RequestContext(request)) >> return render_to_response('ziyaret_kaydet.html', {'zform': >> ZiyaretForm()}, context_instance=RequestContext(request)) >> >> 02 Nisan 2010 19:03 tarihinde H.İbrahim Yılmaz <prehisto...@gmail.com> yazdı: >>> Hi all, >>> Thanks it works! But, i have another question about my view. When i >>> use my view (as seen below) i can't get see the form. >>> Thanks! >>> >>> 2010/4/2 Benjamin Welton <benjamin.r.wel...@wmich.edu>: >>>> def __init__(temsilci = None, *args, **kwargs) >>>> >>>> should include self as the first argument. >>>> >>>> def __init__(self, temsilci = None, *args, **kwargs) >>>> >>>> Ben >>>> >>>> >>>> H.İbrahim Yılmaz wrote: >>>>> >>>>> Hi all, >>>>> I get "global name 'self' is not defined" error what is the problem? >>>>> Thanks. >>>>> >>>>> from django.db import models >>>>> from django.forms import * >>>>> from yenicrm.musteri.models import * >>>>> from django.contrib.auth.models import User >>>>> from django.forms.extras.widgets import * >>>>> >>>>> # Create your models here. >>>>> class Ziyaret(models.Model): >>>>> tarih = models.DateField() >>>>> temsilci = models.ForeignKey(User) >>>>> musteri = models.ForeignKey(Musteri) >>>>> gorusler = models.TextField() >>>>> >>>>> class ZiyaretForm(ModelForm): >>>>> tarih = DateField(widget=SelectDateWidget()) >>>>> musteri = ModelChoiceField(queryset = Musteri.objects.none()) >>>>> >>>>> def __init__(temsilci = None, *args, **kwargs): >>>>> super(ZiyaretForm, self).__init__(*args, **kwargs) >>>>> self.fields["musteri"] = Musteri.objects.none() if temsilci is >>>>> None else Musteri.objects.filter(temsilci = temsilci) >>>>> >>>>> class Meta: >>>>> model = Ziyaret >>>>> exclude = ("temsilci",) >>>>> >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Django users" group. >>>> To post to this group, send email to django-us...@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> django-users+unsubscr...@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/django-users?hl=en. >>>> >>>> >>> >>> >>> >>> -- >>> http://www.arkeoloji.web.tr >>> >> >> >> >> -- >> 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 django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > 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 django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.