summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorTomek Paczkowski <tomek@hauru.eu>2013-02-23 23:20:00 +0100
committerTomek Paczkowski <tomek@hauru.eu>2013-02-23 23:20:00 +0100
commitb88abd684041ffa66bfe445e1ac26164e803d488 (patch)
tree6c244f44ca890142a9139cc06240c0e9b0c2b8b6 /django/utils
parent83ecb7b145644a1489db4137ac4d779bf1f294ca (diff)
Fixed #19872
Made cached_property to behave as property when accessed via class.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/functional.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 1b5200c98c..51001ea655 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -39,7 +39,9 @@ class cached_property(object):
def __init__(self, func):
self.func = func
- def __get__(self, instance, type):
+ def __get__(self, instance, type=None):
+ if instance is None:
+ return self
res = instance.__dict__[self.func.__name__] = self.func(instance)
return res