On Tue, Jun 22, 2010 at 3:45 PM, Daniel Roseman <daniel@roseman.org.uk> wrote:
> What is the preferred way to make e.g. a TextField that will pass validationThe first is just wrong, and certainly isn't documented in that form.
> 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.
You seem to have wrongly conflated some of the syntax from the forms
documentation with the models docs.
Model fields take blank=True/False. Form fields take
'required=False' (or True) as a parameter. However, the field in that
case would be forms.CharField, not models.TextField.
--
DR.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
→ Jonathan Hayward, christos.jonathan.hayward@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 at http://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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment