mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
[FEAT] Move a lot of content/settings to Constance
They can now be changed in the Django admin interface
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
import typing
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
|
||||
from constance import config
|
||||
|
||||
from bootstrap_datepicker_plus.widgets import DatePickerInput
|
||||
from django_select2.forms import ModelSelect2Widget, Select2Widget, Select2MultipleWidget
|
||||
@@ -121,7 +122,7 @@ class OrganisationAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
|
||||
]
|
||||
labels = {
|
||||
'is_partner_organisation':
|
||||
f'Is this organisation a {settings.PARENT_PROJECT_NAME} partner organisation?'
|
||||
f'Is this organisation a {config.PARENT_PROJECT_NAME} partner organisation?'
|
||||
}
|
||||
widgets = {
|
||||
'countries': Select2MultipleWidget(),
|
||||
@@ -192,7 +193,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
|
||||
}
|
||||
labels = {
|
||||
'project_started_date':
|
||||
f'Date started on the {settings.PARENT_PROJECT_NAME} project',
|
||||
f'Date started on the {config.PARENT_PROJECT_NAME} project',
|
||||
'external_organisations':
|
||||
'Please list the main organisations external to BRECcIA work that you have been working with since 1st January 2019 that are involved in food/water security in African dryland regions'
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user