Opened 10 months ago
Last modified 10 months ago
#36076 closed New feature
Raise a check error if null=False and default=None — at Initial Version
| Reported by: | Csirmaz Bendegúz | Owned by: | Csirmaz Bendegúz |
|---|---|---|---|
| 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
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.
Note:
See TracTickets
for help on using tickets.