Changes between Version 1 and Version 2 of Ticket #27955


Ignore:
Timestamp:
Mar 17, 2017, 7:04:28 PM (7 years ago)
Author:
Tim Graham
Comment:

Yes, I think this is a duplicate of #27697, although the desired behavior you describe isn't how Django uses model field defaults. Those defaults are only used to populate the initial the form. If a user removes that value, the default isn't called again when the form is submitted.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27955

    • Property Resolutioninvalid
    • Property Status newclosed
  • Ticket #27955 – Description

    v1 v2  
    99}}}
    1010
    11 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.
     11Creating 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.
    1212
    13 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. 
     13I'm not sure whether this ticket is a duplicate of #27697 but I think this issue with the ignored default may have a different origin. 
Back to Top