#36076: Raise a check error if null=False and default=None
-------------------------------------+-------------------------------------
Reporter: Csirmaz Bendegúz | Owner: (none)
Type: New feature | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):
My point was that we if we permit `blank=True` for non-nullable fields
(see linked discussions) then we should treat `default=None` no
differently. It doesn't seem like a misconfiguration to me. The `default`
kwarg on model fields is only one of several ways of accepting values
before saving a non-nullable field to the database--we shouldn't force
people to choose model field defaults as a way of supplying missing
values.
If part of the proposal was to use a `NOT_PROVIDED` sentinel for the
default value of `default=` so that explicitly providing
`Field(default=None)` can be distinguished from `Field()` and flagged,
then that's a different story, but I'm not sure it's worth it and would
still break existing code.
--
Ticket URL: <https://code.djangoproject.com/ticket/36076#comment:5>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701944b80be0d-0ccd9bbb-81b3-49e1-bac6-30052631d0c0-000000%40eu-central-1.amazonses.com.