Jonathan, I think what you are running into is the differences between how models are declared vs how forms are declared. In models you declare the fields as blank=True and/or null=True to specify that the data stored in the database can be left blank. Something like this:
class MyModel(models.Model): additional_comments = models.TextField(blank=True) When declaring a form, nothing is directly stored in the database so the keyword 'required' is used. For example: class MyForm(forms.Form): additional_comments = forms.TextField(required=False) If you are creating a form from a model, blank=True inside the models is transformed into required=False for the form. class MyModelForm(forms.ModelForm): class Meta: model = MyModel Hope this helps! Dan Harris dih0...@gmail.com On Jun 22, 4:11 pm, Jonathan Hayward <christos.jonathan.hayw...@gmail.com> wrote: > What is the preferred way to make e.g. a TextField that will pass validation > if it is left empty? I've seen two approaches apparently referenced in the > documentation: > > additional_comments = models.TextField(required = False) > > additional_comments = models.TextField(blank = True) > > and run into errors with the first. Does this mean that I should go with the > second, or is there another way that is preferred? > > I'm using 1.2. > > -- > → Jonathan Hayward, christos.jonathan.hayw...@gmail.com > → An Orthodox Christian author: theology, literature, et cetera. > → My award-winning collection is available for free reading online: > ☩ I invite you to visit my main site athttp://JonathansCorner.com/ -- 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.