#36076: Raise a check error if null=False and default=None
-------------------------------------+-------------------------------------
Reporter: Csirmaz Bendegúz | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Csirmaz Bendegúz):
* easy: 0 => 1
* owner: Csirmaz Bendegúz => (none)
* status: assigned => new
Old description:
> 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`.
New description:
If a field has `null=False` Django shouldn't allow setting `default=None`
or `db_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`.
--
Comment:
I think this is an easy win if someone else wants to work on it?
--
Ticket URL: <https://code.djangoproject.com/ticket/36076#comment:1>
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/010701944ad74194-d654aa80-3912-4e6c-9f89-658e1fe5eece-000000%40eu-central-1.amazonses.com.