aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/utils/functional.py
diff options
context:
space:
mode:
authorJannis Leidel2013-04-24 02:51:17 -0700
committerJannis Leidel2013-04-24 02:51:17 -0700
commit1390c405f6718dc44169503176f610f194fe6d41 (patch)
tree70466742c10a71b0164972112bf528a527ada90f /debug_toolbar/utils/functional.py
parent49c09c0b9afb588fa3cde047075331ea81d18a55 (diff)
parentf6b515f71aea595c303d287f121a34ec31c4784c (diff)
downloaddjango-debug-toolbar-1390c405f6718dc44169503176f610f194fe6d41.tar.bz2
Merge pull request #347 from midiotthimble/sql-panel-refactor
Request Line is too large (400) sometimes
Diffstat (limited to 'debug_toolbar/utils/functional.py')
-rw-r--r--debug_toolbar/utils/functional.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/debug_toolbar/utils/functional.py b/debug_toolbar/utils/functional.py
new file mode 100644
index 0000000..1dbb734
--- /dev/null
+++ b/debug_toolbar/utils/functional.py
@@ -0,0 +1,14 @@
+try:
+ from django.utils.functional import cached_property
+except ImportError: # Django < 1.4
+ class cached_property(object):
+ """
+ Decorator that creates converts a method with a single
+ self argument into a property cached on the instance.
+ """
+ def __init__(self, func):
+ self.func = func
+
+ def __get__(self, instance, type):
+ res = instance.__dict__[self.func.__name__] = self.func(instance)
+ return res