diff --git a/breccia_mapper/settings.py b/breccia_mapper/settings.py index 9e55f4f..9a3edb3 100644 --- a/breccia_mapper/settings.py +++ b/breccia_mapper/settings.py @@ -16,6 +16,10 @@ https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ Many configuration settings are input from `settings.ini`. The most likely required settings are: SECRET_KEY, DEBUG, ALLOWED_HOSTS, DATABASE_URL, PROJECT_*_NAME, EMAIL_* +- PARENT_PROJECT_NAME + default: Parent Project Name + Displayed in templates where the name of the parent project should be used + - PROJECT_LONG_NAME default: Project Long Name Displayed in templates where the full name of the project should be used @@ -115,11 +119,13 @@ import dj_database_url SETTINGS_EXPORT = [ 'DEBUG', + 'PARENT_PROJECT_NAME', 'PROJECT_LONG_NAME', 'PROJECT_SHORT_NAME', 'GOOGLE_MAPS_API_KEY', ] +PARENT_PROJECT_NAME = config('PARENT_PROJECT_NAME', default='Parent Project Name') PROJECT_LONG_NAME = config('PROJECT_LONG_NAME', default='Project Long Name') PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', default='shortname') diff --git a/people/forms.py b/people/forms.py index 8551743..f458689 100644 --- a/people/forms.py +++ b/people/forms.py @@ -3,6 +3,7 @@ import typing from django import forms +from django.conf import settings from bootstrap_datepicker_plus import DatePickerInput from django_select2.forms import ModelSelect2Widget, Select2Widget, Select2MultipleWidget @@ -139,6 +140,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase): 'country_of_residence', 'organisation', 'organisation_started_date', + 'project_started_date', 'job_title', 'themes', 'latitude', @@ -148,6 +150,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase): 'nationality': Select2Widget(), 'country_of_residence': Select2Widget(), 'organisation_started_date': DatePickerInput(format='%Y-%m-%d'), + 'project_started_date': DatePickerInput(format='%Y-%m-%d'), 'themes': Select2MultipleWidget(), 'latitude': forms.HiddenInput, 'longitude': forms.HiddenInput, @@ -155,6 +158,9 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase): help_texts = { 'organisation_started_date': 'If you don\'t know the exact date, an approximate date is okay.', + 'project_started_date': + (f'Date you started on the {settings.PARENT_PROJECT_NAME} project. ' + 'If you don\'t know the exact date, an approximate date is okay.'), } question_model = models.PersonQuestion diff --git a/people/migrations/0038_project_started_date.py b/people/migrations/0038_project_started_date.py new file mode 100644 index 0000000..f6732c6 --- /dev/null +++ b/people/migrations/0038_project_started_date.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.10 on 2021-03-01 19:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('people', '0037_alternate_filter_text'), + ] + + operations = [ + migrations.AddField( + model_name='personanswerset', + name='project_started_date', + field=models.DateField(null=True), + ), + migrations.AlterField( + model_name='personquestion', + name='answer_is_public', + field=models.BooleanField(default=True, help_text='Should answers to this question be considered public?'), + ), + ] diff --git a/people/models/person.py b/people/models/person.py index 2f110d5..7489f97 100644 --- a/people/models/person.py +++ b/people/models/person.py @@ -272,6 +272,9 @@ class PersonAnswerSet(AnswerSet): organisation_started_date = models.DateField( 'Date started at this organisation', blank=False, null=True) + #: When did this person join the project? + project_started_date = models.DateField(blank=False, null=True) + #: Job title this person holds within their organisation job_title = models.CharField(max_length=255, blank=True, null=False) diff --git a/people/templates/people/person/includes/answer_set_full.html b/people/templates/people/person/includes/answer_set_full.html index 799464e..c4aac76 100644 --- a/people/templates/people/person/includes/answer_set_full.html +++ b/people/templates/people/person/includes/answer_set_full.html @@ -23,6 +23,10 @@ Organisation Started Date{{ answer_set.organisation_started_date }} {% endif %} + {% if answer_set.project_started_date %} + {{ settings.PARENT_PROJECT_NAME }} Started Date{{ answer_set.project_started_date }} + {% endif %} + {% if answer_set.job_title %} Job Title{{ answer_set.job_title }} {% endif %} diff --git a/roles/webserver/defaults/main.yml b/roles/webserver/defaults/main.yml index bc0d0af..5608fa8 100644 --- a/roles/webserver/defaults/main.yml +++ b/roles/webserver/defaults/main.yml @@ -7,6 +7,7 @@ deploy_mode: 3 secret_key: '{{ lookup("password", "/dev/null") }}' +parent_project_name: 'BRECcIA' project_name: 'breccia-mapper' project_full_name: 'breccia_mapper' project_dir: '/var/www/{{ project_name }}' diff --git a/roles/webserver/templates/settings.j2 b/roles/webserver/templates/settings.j2 index e9ccb89..b270b08 100644 --- a/roles/webserver/templates/settings.j2 +++ b/roles/webserver/templates/settings.j2 @@ -11,6 +11,7 @@ ALLOWED_HOSTS={% for h in allowed_hosts %}{{ h }},{% endfor %} ALLOWED_HOSTS={{ inventory_hostname }},localhost,127.0.0.1 {% endif %} +PARENT_PROJECT_NAME={{ parent_project_name }} PROJECT_SHORT_NAME={{ display_short_name }} PROJECT_LONG_NAME={{ display_long_name }}