Opened 8 years ago
Last modified 8 years ago
#27955 closed Bug
JSONField.default not applied in admin — at Version 1
Reported by: | Jannis Vajen | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.10 |
Severity: | Normal | Keywords: | JSONField, admin |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Consider a model like this:
class Example(models.Model): json = JSONField( default=list, blank=True )
Creating an object programmatically works and applies the default value just fine. Saving an object with an empty value for the JSONField
triggers an IntegrityError because Django tries to save an object with null
instead of the default.
I'm not sure whether this ticket is a duplicate of https://code.djangoproject.com/ticket/27697 but I think this issue with the ignored default may have a different origin.
Note:
See TracTickets
for help on using tickets.