Changes between Version 2 and Version 6 of Ticket #29549


Ignore:
Timestamp:
Aug 9, 2018, 4:47:47 AM (6 years ago)
Author:
Evgeny Arshinov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29549

    • Property Summary Model.save() doesn't validate CHOICESDocument that Field.choices are enforced by model validation
    • Property Component Database layer (models, ORM)Documentation
    • Property Has patch set
    • Property Owner changed from nobody to Tim Graham
    • Property Triage Stage UnreviewedAccepted
    • Property Status newclosed
    • Property Type UncategorizedCleanup/optimization
    • Property Resolutionfixed
  • Ticket #29549 – Description

    v2 v6  
    33For some reason, only form validation was considered in the original ticket, but data validation is not limited to that, but also includes data integrity checks running when one calls `model_instance.save()`.
    44
    5 As a developer, I would expect `model_instance.save()` to validate the `choices` field against the list of possible choices, not least because the list is defined at the model level, participates in db migrations etc., so it should take effect on modal instances.
     5As a developer, I would expect `model_instance.save()` to validate the `choices` field against the list of possible choices, not least because the list is defined at the model level, participates in db migrations etc., so it should take effect on model instances.
    66
    77I haven't been able to find any documentation or existing bug reports that clearly state that [https://docs.djangoproject.com/en/2.0/ref/models/fields/#choices choices] argument only affects the corresponding model form field presentation and does not ensure data integrity.
Back to Top