Opened 13 years ago
Closed 12 years ago
#18362 closed Bug (fixed)
model save with update_fields should accept both field.name and field.attname
Reported by: | Anssi Kääriäinen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | niwi@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 13 years ago
Cc: | added |
---|---|
Has patch: | set |
Posible fix: https://github.com/niwibe/django/tree/ticket_18362
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
hmmh - I can't edit the description. so, in above the examples are
"update_fields=['profile']/['profile_id']"
instead of the helpful wiki-links...