diff options
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/functional.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py index 65a9b9d7aa..e6dbeb32e0 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -280,6 +280,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. |
