feat: add project started date to person questions

Resolves #60
This commit is contained in:
James Graham
2021-03-01 19:26:59 +00:00
parent db76d57971
commit 6d5188af72
7 changed files with 44 additions and 0 deletions

View File

@@ -16,6 +16,10 @@ https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
Many configuration settings are input from `settings.ini`. Many configuration settings are input from `settings.ini`.
The most likely required settings are: SECRET_KEY, DEBUG, ALLOWED_HOSTS, DATABASE_URL, PROJECT_*_NAME, EMAIL_* 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 - PROJECT_LONG_NAME
default: Project Long Name default: Project Long Name
Displayed in templates where the full name of the project should be used Displayed in templates where the full name of the project should be used
@@ -115,11 +119,13 @@ import dj_database_url
SETTINGS_EXPORT = [ SETTINGS_EXPORT = [
'DEBUG', 'DEBUG',
'PARENT_PROJECT_NAME',
'PROJECT_LONG_NAME', 'PROJECT_LONG_NAME',
'PROJECT_SHORT_NAME', 'PROJECT_SHORT_NAME',
'GOOGLE_MAPS_API_KEY', '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_LONG_NAME = config('PROJECT_LONG_NAME', default='Project Long Name')
PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', default='shortname') PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', default='shortname')

View File

@@ -3,6 +3,7 @@
import typing import typing
from django import forms from django import forms
from django.conf import settings
from bootstrap_datepicker_plus import DatePickerInput from bootstrap_datepicker_plus import DatePickerInput
from django_select2.forms import ModelSelect2Widget, Select2Widget, Select2MultipleWidget from django_select2.forms import ModelSelect2Widget, Select2Widget, Select2MultipleWidget
@@ -139,6 +140,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
'country_of_residence', 'country_of_residence',
'organisation', 'organisation',
'organisation_started_date', 'organisation_started_date',
'project_started_date',
'job_title', 'job_title',
'themes', 'themes',
'latitude', 'latitude',
@@ -148,6 +150,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
'nationality': Select2Widget(), 'nationality': Select2Widget(),
'country_of_residence': Select2Widget(), 'country_of_residence': Select2Widget(),
'organisation_started_date': DatePickerInput(format='%Y-%m-%d'), 'organisation_started_date': DatePickerInput(format='%Y-%m-%d'),
'project_started_date': DatePickerInput(format='%Y-%m-%d'),
'themes': Select2MultipleWidget(), 'themes': Select2MultipleWidget(),
'latitude': forms.HiddenInput, 'latitude': forms.HiddenInput,
'longitude': forms.HiddenInput, 'longitude': forms.HiddenInput,
@@ -155,6 +158,9 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
help_texts = { help_texts = {
'organisation_started_date': 'organisation_started_date':
'If you don\'t know the exact date, an approximate date is okay.', '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 question_model = models.PersonQuestion

View File

@@ -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?'),
),
]

View File

@@ -272,6 +272,9 @@ class PersonAnswerSet(AnswerSet):
organisation_started_date = models.DateField( organisation_started_date = models.DateField(
'Date started at this organisation', blank=False, null=True) '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 this person holds within their organisation
job_title = models.CharField(max_length=255, blank=True, null=False) job_title = models.CharField(max_length=255, blank=True, null=False)

View File

@@ -23,6 +23,10 @@
<tr><td>Organisation Started Date</td><td>{{ answer_set.organisation_started_date }}</td></tr> <tr><td>Organisation Started Date</td><td>{{ answer_set.organisation_started_date }}</td></tr>
{% endif %} {% endif %}
{% if answer_set.project_started_date %}
<tr><td>{{ settings.PARENT_PROJECT_NAME }} Started Date</td><td>{{ answer_set.project_started_date }}</td></tr>
{% endif %}
{% if answer_set.job_title %} {% if answer_set.job_title %}
<tr><td>Job Title</td><td>{{ answer_set.job_title }}</td></tr> <tr><td>Job Title</td><td>{{ answer_set.job_title }}</td></tr>
{% endif %} {% endif %}

View File

@@ -7,6 +7,7 @@ deploy_mode: 3
secret_key: '{{ lookup("password", "/dev/null") }}' secret_key: '{{ lookup("password", "/dev/null") }}'
parent_project_name: 'BRECcIA'
project_name: 'breccia-mapper' project_name: 'breccia-mapper'
project_full_name: 'breccia_mapper' project_full_name: 'breccia_mapper'
project_dir: '/var/www/{{ project_name }}' project_dir: '/var/www/{{ project_name }}'

View File

@@ -11,6 +11,7 @@ ALLOWED_HOSTS={% for h in allowed_hosts %}{{ h }},{% endfor %}
ALLOWED_HOSTS={{ inventory_hostname }},localhost,127.0.0.1 ALLOWED_HOSTS={{ inventory_hostname }},localhost,127.0.0.1
{% endif %} {% endif %}
PARENT_PROJECT_NAME={{ parent_project_name }}
PROJECT_SHORT_NAME={{ display_short_name }} PROJECT_SHORT_NAME={{ display_short_name }}
PROJECT_LONG_NAME={{ display_long_name }} PROJECT_LONG_NAME={{ display_long_name }}