Opened 8 years ago

Last modified 8 years ago

#27955 closed Bug

JSONField.default not applied in admin — at Initial Version

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

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.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top