Changes between Version 2 and Version 6 of Ticket #29549
- Timestamp:
- Aug 9, 2018, 4:47:47 AM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29549
- Property Summary Model.save() doesn't validate CHOICES → Document that Field.choices are enforced by model validation
- Property Component Database layer (models, ORM) → Documentation
- Property Has patch set
- Property Owner changed from to
- Property Triage Stage Unreviewed → Accepted
- Property Status new → closed
- Property Type Uncategorized → Cleanup/optimization
- Property Resolution → fixed
-
Ticket #29549 – Description
v2 v6 3 3 For 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()`. 4 4 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 mod al instances.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 model instances. 6 6 7 7 I 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.