Opened 10 months ago
Last modified 10 months ago
#36076 closed New feature
Raise a check error if null=False and default=None — at Version 1
| Reported by: | Csirmaz Bendegúz | Owned by: | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Csirmaz Bendegúz | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
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.
Change History (1)
comment:1 by , 10 months ago
| Description: | modified (diff) |
|---|---|
| Easy pickings: | set |
| Owner: | removed |
| Status: | assigned → new |
Note:
See TracTickets
for help on using tickets.
I think this is an easy win if someone else wants to work on it?