model save with update_fields should accept both field.name and field.attname
|Reported by:||akaariai||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently only field.name is accepted in update_fields argument. It seems field.attname should be accepted, too. Most commonly this will be encountered when trying to save a related field by "_id" appendix - for example update_fields=profile? will work, but update_fieldsprofile_id? will not work currently.
In my opinion this should work, as profile_id works in many other places, too, and this could be useful for automatic tracking of field changes for example.
Change History (3)
comment:1 Changed 4 years ago by akaariai
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted