From 136bf5c2142ae3261669d02e2dd050c3141f7f2f Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 30 Jan 2018 07:43:53 -0800 Subject: Fixed #29076 -- Made Model.refresh_from_db() clear cached relationships even if the related id doesn't change. --- docs/ref/models/instances.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index c327b0e9e7..73bbeb8f31 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -137,12 +137,7 @@ following is done: 1. All non-deferred fields of the model are updated to the values currently present in the database. -2. The previously loaded related instances for which the relation's value is no - longer valid are removed from the reloaded instance. For example, if you have - a foreign key from the reloaded instance to another model with name - ``Author``, then if ``obj.author_id != obj.author.id``, ``obj.author`` will - be thrown away, and when next accessed it will be reloaded with the value of - ``obj.author_id``. +2. Any cached relations are cleared from the reloaded instance. Only fields of the model are reloaded from the database. Other database-dependent values such as annotations aren't reloaded. Any -- cgit v1.3