summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-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