[FEAT] Move a lot of content/settings to Constance

They can now be changed in the Django admin interface
This commit is contained in:
2023-01-05 23:43:31 +00:00
parent c5dca62b0b
commit 0355392675
9 changed files with 149 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
import typing
from django.conf import settings
from constance import config
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
@@ -49,11 +50,11 @@ class OrganisationListView(LoginRequiredMixin, ListView):
orgs_sorted = {}
try_copy_by_key(orgs_by_country, orgs_sorted,
f'{settings.PARENT_PROJECT_NAME} partners')
f'{config.PARENT_PROJECT_NAME} partners')
try_copy_by_key(orgs_by_country, orgs_sorted, 'International')
special = {
f'{settings.PARENT_PROJECT_NAME} partners', 'International',
f'{config.PARENT_PROJECT_NAME} partners', 'International',
'Unknown'
}
for country in sorted(k for k in orgs_by_country.keys()
@@ -81,7 +82,7 @@ class OrganisationListView(LoginRequiredMixin, ListView):
country = 'International'
if answers.is_partner_organisation:
country = f'{settings.PARENT_PROJECT_NAME} partners'
country = f'{config.PARENT_PROJECT_NAME} partners'
except AttributeError:
# Organisation has no AnswerSet - country is 'Unknown'