summaryrefslogtreecommitdiff
path: root/django/conf/__init__.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2019-01-11 15:28:22 -0500
committerGitHub <noreply@github.com>2019-01-11 15:28:22 -0500
commit8f4eee177785cba27d6181840206ff2f164f2960 (patch)
tree72a5627fc929badb80be81b4addfaa23fad4927f /django/conf/__init__.py
parent76d31be2d04dd6e6bcb5cb39a29ea9ed3938d0f9 (diff)
Moved django.db.migrations.writer.SettingsReference to django.conf.
Reduces the possibility of circular imports.
Diffstat (limited to 'django/conf/__init__.py')
-rw-r--r--django/conf/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index 73d943d26e..cf91ce83d4 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -30,6 +30,18 @@ FILE_CHARSET_DEPRECATED_MSG = (
)
+class SettingsReference(str):
+ """
+ String subclass which references a current settings value. It's treated as
+ the value in memory but serializes to a settings.NAME attribute reference.
+ """
+ def __new__(self, value, setting_name):
+ return str.__new__(self, value)
+
+ def __init__(self, value, setting_name):
+ self.setting_name = setting_name
+
+
class LazySettings(LazyObject):
"""
A lazy proxy for either global Django settings or a custom settings object.