1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Updated docs example to clear cached_property without raising AttributeError.

Signed-off-by: SaJH <wogur981208@gmail.com>
This commit is contained in:
SaJH 2024-09-09 23:41:56 +09:00 committed by Sarah Boyce
parent b8f9f625a1
commit b0d9c1fe32

View File

@ -521,7 +521,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004
The cached value can be treated like an ordinary attribute of the instance:: The cached value can be treated like an ordinary attribute of the instance::
# clear it, requiring re-computation next time it's called # clear it, requiring re-computation next time it's called
del person.friends # or delattr(person, "friends") person.__dict__.pop("friends", None)
# set a value manually, that will persist on the instance until cleared # set a value manually, that will persist on the instance until cleared
person.friends = ["Huckleberry Finn", "Tom Sawyer"] person.friends = ["Huckleberry Finn", "Tom Sawyer"]