Repository: imAsparky/django-cookiecutter

Issue:
[FEAT]: Add configurable project settings to Admin
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Its not best practice to access the django settings in normal operations.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

Add django-constance to provide a simple means to employ configurable site settings.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.



Discussion:

Resolving patch:
diff --git a/{{cookiecutter.git_project_name}}/config/settings/base.py b/{{cookiecutter.git_project_name}}/config/settings/base.py
--- a/{{cookiecutter.git_project_name}}/config/settings/base.py
+++ b/{{cookiecutter.git_project_name}}/config/settings/base.py
@@ -62,7 +62,9 @@
 
 # Application definition
 
-INSTALLED_APPS = [
+INSTALLED_APPS = [{% if cookiecutter.use_constance != "n" %}
+    "constance",
+    "constance.backends.database",{% endif %}
     "users",
     "django.contrib.admin",
     "django.contrib.auth",
@@ -142,7 +144,22 @@
         "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
     },
 ]
+{% if cookiecutter.use_constance != "n" %}
+# Constance Configuration
+CONSTANCE_BACKEND = "constance.backends.database.DatabaseBackend"
+
+CONSTANCE_CONFIG = {
+    "THE_ANSWER": (
+        42,
+        "Answer to the Ultimate Question of Life, The Universe, and Everything",
+        int,
+    ),
+}
 
+CONSTANCE_CONFIG_FIELDSETS = {
+    "The Answer": ("THE_ANSWER",),
+}
+{% endif %}
 # Internationalization
 # https://docs.djangoproject.com/en/4.0/topics/i18n/
 {%- set language_labels = ({


Test patch:
diff --git a/tests/test_bake_django.py b/tests/test_bake_django.py
--- a/tests/test_bake_django.py
+++ b/tests/test_bake_django.py
@@ -189,6 +189,59 @@ def test_baked_django_without_commit_message_file(cookies):
         non_default_django.project_path / ".github"
     )
 
+def test_baked_django_without_constance_config_in_base_py(cookies):
+    """Test django-constance not installed."""
+    default_django = cookies.bake()
+
+    list_path = default_django.project_path / "config/settings/base.py"
+    list_file = str(list_path.read_text().splitlines())
+
+    assert "constance" not in list_file
+    assert "constance.backends.database" not in list_file
+    assert "# Constance Configuration" not in list_file
+
+
+
+def test_baked_django_with_constance_config_in_base_py(cookies):
+    """Test django-constance installed correctly."""
+    non_default_django = cookies.bake(
+        extra_context={
+            "use_constance": "y",
+        }
+    )
+
+    list_path = non_default_django.project_path / "config/settings/base.py"
+    list_file = str(list_path.read_text().splitlines())
+
+    assert "constance" in list_file
+    assert "constance.backends.database" in list_file
+    assert "# Constance Configuration" in list_file
+
+
+
+
+def test_baked_django_without_constance_config_in_base_txt(cookies):
+    """Test django-constance not installed."""
+    default_django = cookies.bake()
+
+    list_path = default_django.project_path / "config/requirements/base.txt"
+    list_file = str(list_path.read_text().splitlines())
+
+    assert 'django-constance[database]==' not in list_file
+
+
+def test_baked_django_with_constance_config_in_base_txt(cookies):
+    """Test django-constance installed correctly."""
+    non_default_django = cookies.bake(
+        extra_context={
+            "use_constance": "y",
+        }
+    )
+
+    list_path = non_default_django.project_path / "config/requirements/base.txt"
+    list_file = str(list_path.read_text().splitlines())
+
+    assert 'django-constance[database]==' in list_file
 
 def test_baked_django_with_custom_issue_template_files(cookies):
     """Test Django project has custom ISSUE templates generated correctly.