diff options
| author | André Ericson <de.ericson@gmail.com> | 2019-10-18 21:00:34 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-10-21 09:57:39 +0200 |
| commit | 312049091288dbba2299de8d07ea3e3311ed7238 (patch) | |
| tree | f279e94af6d3fe6bddb33afcb0ce8928b9cf1fd6 /django/utils/functional.py | |
| parent | 31174031f1ded30d96c77908b965755e0be94c94 (diff) | |
Fixed #30876 -- Moved classproperty() decorator to the django.utils.functional.
Diffstat (limited to 'django/utils/functional.py')
| -rw-r--r-- | django/utils/functional.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py index 1b81d414fa..bc3b65b709 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -49,6 +49,18 @@ class cached_property: return res +class classproperty: + def __init__(self, method=None): + self.fget = method + + def __get__(self, instance, cls=None): + return self.fget(cls) + + def getter(self, method): + self.fget = method + return self + + class Promise: """ Base class for the proxy class created in the closure of the lazy function. |
