Login

Tag "bool"

Snippet List

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

1 snippet posted so far.