Opened 7 years ago

Closed 7 years ago

#29263 closed Bug (invalid)

Model.refresh_from_db() does not re-calculate annotation fields

Reported by: Sam Frances Owned by: nobody
Component: Database layer (models, ORM) Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Running refresh_from_db() on a model which was retrieved using an annotated query, does not update any fields that were added by that annotated query.

Change History (1)

comment:1 by Tim Graham, 7 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: invalid
Status: newclosed

That's by design:

Only fields of the model are reloaded from the database. Other database-dependent values such as annotations aren’t reloaded. Any @cached_property attributes aren’t cleared either.

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