Opened 8 years ago

Closed 8 years ago

#18362 closed Bug (fixed)

model save with update_fields should accept both and field.attname

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Database layer (models, ORM) Version: master
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


Currently only 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.

Refs #4102, #18306.

Change History (3)

comment:1 Changed 8 years ago by Anssi Kääriäinen

Triage Stage: UnreviewedAccepted

hmmh - I can't edit the description. so, in above the examples are "update_fields=['profile']/['profile_id']" instead of the helpful wiki-links...

comment:2 Changed 8 years ago by Andrei Antoukh

Cc: niwi@… added
Has patch: set

comment:3 Changed 8 years ago by Anssi Kääriäinen <akaariai@…>

Resolution: fixed
Status: newclosed

In [0f49b2bce2d5b3c5891c8a329bab7dffe16fc79b]:

Fixed #18362 - Made update_fields accept attnames

Note: See TracTickets for help on using tickets.
Back to Top