From cfaf53cbb1751d779cd2d41ef2f028b60cbb8742 Mon Sep 17 00:00:00 2001 From: michaelglenister Date: Mon, 10 Jan 2022 16:07:27 +0200 Subject: [PATCH] Move site notices to a seperate Django app --- municipal_finance/admin.py | 4 ---- municipal_finance/context_processors.py | 2 +- municipal_finance/models/__init__.py | 2 -- municipal_finance/settings.py | 1 + site_config/__init__.py | 0 site_config/admin.py | 5 +++++ site_config/apps.py | 5 +++++ .../migrations/0001_initial.py | 5 +++-- site_config/migrations/__init__.py | 0 municipal_finance/models/notice.py => site_config/models.py | 3 +-- 10 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 site_config/__init__.py create mode 100644 site_config/admin.py create mode 100644 site_config/apps.py rename municipal_finance/migrations/0041_sitenotice.py => site_config/migrations/0001_initial.py (87%) create mode 100644 site_config/migrations/__init__.py rename municipal_finance/models/notice.py => site_config/models.py (99%) diff --git a/municipal_finance/admin.py b/municipal_finance/admin.py index 7d09ecf15..791b286e2 100644 --- a/municipal_finance/admin.py +++ b/municipal_finance/admin.py @@ -5,7 +5,6 @@ from django.contrib import admin from django_q.tasks import async_task from import_export.admin import ImportExportModelAdmin -from adminsortable.admin import SortableAdmin from .models import ( MunicipalStaffContactsUpdate, @@ -30,7 +29,6 @@ GrantTypesV2, CapitalTypeV2, DemarcationChanges, - SiteNotice, ) from .resources import ( AgedDebtorItemsV2Resource, @@ -204,5 +202,3 @@ class DemarcationChangesAdmin(admin.ModelAdmin): "old_code_transition", "new_code_transition", ) - -admin.site.register(SiteNotice, SortableAdmin) diff --git a/municipal_finance/context_processors.py b/municipal_finance/context_processors.py index 138b61405..3462f8503 100644 --- a/municipal_finance/context_processors.py +++ b/municipal_finance/context_processors.py @@ -1,6 +1,6 @@ from django.conf import settings from django.contrib.sites.shortcuts import get_current_site -from municipal_finance import models +from site_config import models def google_analytics(request): diff --git a/municipal_finance/models/__init__.py b/municipal_finance/models/__init__.py index 8b010d1c4..dcd7be7e3 100644 --- a/municipal_finance/models/__init__.py +++ b/municipal_finance/models/__init__.py @@ -84,8 +84,6 @@ ) from .demarcation_changes import DemarcationChanges -from .notice import SiteNotice - class AuditOpinionFacts(models.Model): demarcation_code = models.TextField() diff --git a/municipal_finance/settings.py b/municipal_finance/settings.py index 1a981de73..34f18e06a 100644 --- a/municipal_finance/settings.py +++ b/municipal_finance/settings.py @@ -55,6 +55,7 @@ "infrastructure", "household", "webflow", + "site_config", "django.contrib.sites", "django.contrib.contenttypes", "django.contrib.humanize", diff --git a/site_config/__init__.py b/site_config/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/site_config/admin.py b/site_config/admin.py new file mode 100644 index 000000000..035fffa2c --- /dev/null +++ b/site_config/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from adminsortable.admin import SortableAdmin +from . import models + +admin.site.register(models.SiteNotice, SortableAdmin) \ No newline at end of file diff --git a/site_config/apps.py b/site_config/apps.py new file mode 100644 index 000000000..03ea2de0c --- /dev/null +++ b/site_config/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class SiteConfigConfig(AppConfig): + name = 'site_config' diff --git a/municipal_finance/migrations/0041_sitenotice.py b/site_config/migrations/0001_initial.py similarity index 87% rename from municipal_finance/migrations/0041_sitenotice.py rename to site_config/migrations/0001_initial.py index a9ce0125e..bb6172578 100644 --- a/municipal_finance/migrations/0041_sitenotice.py +++ b/site_config/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.29 on 2022-01-03 14:47 +# Generated by Django 1.11.29 on 2022-01-10 14:03 from __future__ import unicode_literals import ckeditor.fields @@ -8,8 +8,9 @@ class Migration(migrations.Migration): + initial = True + dependencies = [ - ('municipal_finance', '0040_auto_20210222_0541'), ] operations = [ diff --git a/site_config/migrations/__init__.py b/site_config/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/municipal_finance/models/notice.py b/site_config/models.py similarity index 99% rename from municipal_finance/models/notice.py rename to site_config/models.py index f0c4a37a6..9c1a75c47 100644 --- a/municipal_finance/models/notice.py +++ b/site_config/models.py @@ -1,7 +1,6 @@ +from django.db import models import ckeditor.fields as ckeditor_fields from adminsortable.models import SortableMixin -from django.db import models - class SiteNotice(SortableMixin): description = models.CharField(max_length=200)