﻿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
29911	Standardize delete_cached_value API on model Fields	Taylor H	nobody	"I created a custom Django model field that is expensive to calculate and I store a cached value on the model. I am not able to clear the cache when some uses the `refresh_from_db()` method though, since there is no standard API to hook into it. It appears that there is a custom behavior for `ForeignKey` that calls the `delete_cached_value` function, if it detects it's a `ForeignKey`

https://github.com/django/django/blob/master/django/db/models/base.py#L569

It would be great to allow any custom Field to implement `delete_cached_value` and have it called inside `refresh_from_db`. What are your thoughts? I would be happy to submit a PR if this seems reasonable"	New feature	closed	Database layer (models, ORM)	2.1	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
