diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index 35f4ec8..f4d17ca 100644
a
|
b
|
class UserSettingsHolder(BaseSettings):
|
152 | 152 | Requests for configuration variables not in this class are satisfied |
153 | 153 | from the module specified in default_settings (if possible). |
154 | 154 | """ |
| 155 | self.__dict__['_deleted'] = set() |
155 | 156 | self.default_settings = default_settings |
156 | 157 | |
157 | 158 | def __getattr__(self, name): |
| 159 | if name in self._deleted: |
| 160 | raise AttributeError |
158 | 161 | return getattr(self.default_settings, name) |
159 | 162 | |
| 163 | def __setattr__(self, name, value): |
| 164 | self._deleted.discard(name) |
| 165 | return super(UserSettingsHolder, self).__setattr__(name, value) |
| 166 | |
| 167 | def __delattr__(self, name): |
| 168 | self._deleted.add(name) |
| 169 | return super(UserSettingsHolder, self).__delattr__(name) |
| 170 | |
160 | 171 | def __dir__(self): |
161 | 172 | return list(self.__dict__) + dir(self.default_settings) |
162 | 173 | |
diff --git a/tests/regressiontests/settings_tests/tests.py b/tests/regressiontests/settings_tests/tests.py
index ffcb79e..7225fb0 100644
a
|
b
|
class SettingsTests(TestCase):
|
148 | 148 | def test_settings_delete_wrapped(self): |
149 | 149 | self.assertRaises(TypeError, delattr, settings, '_wrapped') |
150 | 150 | |
| 151 | def test_override_settings_delete(self): |
| 152 | """ |
| 153 | Allow deletion of a setting in an overriden settings set (#18824) |
| 154 | """ |
| 155 | previous_i18n = settings.USE_I18N |
| 156 | with self.settings(USE_I18N=False): |
| 157 | del settings.USE_I18N |
| 158 | self.assertRaises(AttributeError, getattr, settings, 'USE_I18N') |
| 159 | self.assertEqual(settings.USE_I18N, previous_i18n) |
| 160 | |
151 | 161 | def test_allowed_include_roots_string(self): |
152 | 162 | """ |
153 | 163 | ALLOWED_INCLUDE_ROOTS is not allowed to be incorrectly set to a string |