﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29076	Make Model.refresh_from_db() clear cached foreign key and one to one fields, even if the related ID hasn't changed	Jon Dufresne	nobody	"Currently, `Model.refresh_from_db()` doesn't clear cached foreign key or one to one fields if the related ID has not changed. I find this behavior counter intuitive and almost always undesired.

`Model.refresh_from_db()` is frequently used in testing. For the model to be in an incompletely reloaded state can cause silent test passes or unexpected test failures.

In my experience, this has behavior has also been a frequent pain point for developers just learning the framework. Intuitively, most developers think refreshing a model will refresh all attributes.

True, this behavior is documented. But I think it can be improved to more often do the expected thing and help new Django developers.

A common use case:

A model instance with many fields relationships is altered by a view. A test reloads the model to verify the instance changed as expected, including the relationships."	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed		Anssi Kääriäinen Carlton Gibson	Ready for checkin	1	0	0	0	0	0
