#16251: Db/Models: distinction btw "null" and "blank"
---------------------------+-------------------------------
Reporter: MixedContent | Owner: nobody
Type: Uncategorized | Status: new
Milestone: | Component: Documentation
Version: 1.3 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------+-------------------------------
In the 1.3 doc (https://docs.djangoproject.com/en/1.3/topics/db/models/),
some distinctions are drawn between allowing/disallowing null in the
database and allowing/disallowing blank on data-entry:
====
null
If True, Django will store empty values as NULL in the
database. Default is False.
blank
If True, the field is allowed to be blank. Default is False.
Note that this is different than null. null is purely
database-related, whereas blank is validation-related. If a field
has blank=True, validation on Django's admin site will allow entry
of an empty value. If a field has blank=False, the field will be
required.
====
This leaves me, and I suspect at least some other newbies, wondering what
happens if 1. blank is allowed on data-entry, 2. null is not allowed in
the database, and 3. a user leaves a field blank. Is the input rejected?
Is a default, non-null value inserted? Are developers advised not to
allow conditions 1. and 2. both to apply in the same instance?
It occurs to me that this might have been intentionally "left as an
exercise for the reader," but I'd suggest that approach would be more
correct in the tutorial than in the ref.
--
Ticket URL: <https://code.djangoproject.com/ticket/16251>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.