summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/functional.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 434b6b76c9..823cda4587 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -277,6 +277,13 @@ class LazyObject(object):
self._setup()
setattr(self._wrapped, name, value)
+ def __delattr__(self, name):
+ if name == "_wrapped":
+ raise TypeError("can't delete _wrapped.")
+ if self._wrapped is None:
+ self._setup()
+ delattr(self._wrapped, name)
+
def _setup(self):
"""
Must be implemented by subclasses to initialise the wrapped object.