Login

Tag "required"

2 snippets

Snippet List

mark a required field by "*" in a template

the trick resides in `field.field.required`. The intuitive way of testing this in the templates is to access `field.required`. But it's not the good one. Enjoy! [Found via Django users Google Groups](http://groups.google.com/group/django-users/browse_thread/thread/ce83f74fb1156b4b/0df36947de16a071?lnk=gst&q=required+field#0df36947de16a071)

  • newforms
  • forms
  • templates
  • field
  • required
Read More

RequiredNullBooleanField

In our situation, we want the user to choose either yes or no. The only requirement is that they fill out the form. It is _not_ required that they answer True/Yes. The BooleanField treats None and False as False; The NullBooleanField distinguishes between None and False, but it doesn't raise any validation errors. Subclassing the NullBooleanField was better than overriding the clean method on all of our NullBooleanField instances.

  • required
  • boolean
  • bool
  • boolean-field
  • null-boolean-field
Read More