Opened 7 years ago
Last modified 10 months ago
#28589 assigned Cleanup/optimization
When saving in admin, readonly fields are saved again — at Initial Version
Reported by: | Fingal Plumpton | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | Admin SQL Overwrite |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
On the admin page for a model, if a field is in readonly_fields, then saving that model from the admin will create an SQL query that sets the readonly field to it's value at the time the save button was clicked. This field might have been changed (e.g. by a command or some other process) during the time that the model is being saved, and with current behaviour it would then be overwritten to it's old value.
Correct behaviour would be to not set the readonly field at all in the SQL query.