#36076: Raise a check error if null=False and default=None
-------------------------------------+-------------------------------------
Reporter: Csirmaz | Owner: Csirmaz Bendegúz
Bendegúz |
Type: New | Status: assigned
feature |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If a field has `null=False` Django shouldn't allow setting `default=None`.
{{{
class Model(models.Model):
text = models.TextField(default=None)
}}}
This will raise an `IntegrityError` on create.
It could be prevented with a system check.
Same applies to `db_default`.
--
Ticket URL: <https://code.djangoproject.com/ticket/36076>
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/010701944ad541ed-c4ebf714-d3c8-4450-9c0c-f89df8d46565-000000%40eu-central-1.amazonses.com.