mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
feat: add question on external organisations
This commit is contained in:
@@ -71,13 +71,14 @@ class DynamicAnswerSetBase(forms.Form):
|
|||||||
if as_filters and question.filter_text:
|
if as_filters and question.filter_text:
|
||||||
field_label = question.filter_text
|
field_label = question.filter_text
|
||||||
|
|
||||||
field = field_class(label=field_label,
|
field = field_class(
|
||||||
queryset=question.answers,
|
label=field_label,
|
||||||
widget=field_widget,
|
queryset=question.answers,
|
||||||
required=(self.field_required
|
widget=field_widget,
|
||||||
and not question.allow_free_text),
|
required=(self.field_required
|
||||||
initial=initial.get(field_name, None),
|
and not question.allow_free_text),
|
||||||
help_text=question.help_text if not as_filters else '')
|
initial=initial.get(field_name, None),
|
||||||
|
help_text=question.help_text if not as_filters else '')
|
||||||
self.fields[field_name] = field
|
self.fields[field_name] = field
|
||||||
field_order.append(field_name)
|
field_order.append(field_name)
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
|
|||||||
'organisation_started_date',
|
'organisation_started_date',
|
||||||
'project_started_date',
|
'project_started_date',
|
||||||
'job_title',
|
'job_title',
|
||||||
|
'external_organisations',
|
||||||
'latitude',
|
'latitude',
|
||||||
'longitude',
|
'longitude',
|
||||||
]
|
]
|
||||||
@@ -178,12 +180,18 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
|
|||||||
labels = {
|
labels = {
|
||||||
'project_started_date':
|
'project_started_date':
|
||||||
f'Date started on the {settings.PARENT_PROJECT_NAME} project',
|
f'Date started on the {settings.PARENT_PROJECT_NAME} project',
|
||||||
|
'external_organisations':
|
||||||
|
(f'Please list the main organisations external to {settings.PARENT_PROJECT_NAME} '
|
||||||
|
'work that you have been working with since 1st January 2019 that are '
|
||||||
|
'involved in food/water security in African dryland regions'),
|
||||||
}
|
}
|
||||||
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':
|
'project_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.',
|
||||||
|
'external_organisations':
|
||||||
|
'Please use commas to separate organisation names.',
|
||||||
}
|
}
|
||||||
|
|
||||||
question_model = models.PersonQuestion
|
question_model = models.PersonQuestion
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.2.10 on 2021-03-10 10:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('people', '0045_question_help_text'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='personanswerset',
|
||||||
|
name='external_organisations',
|
||||||
|
field=models.CharField(blank=True, max_length=1023),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -169,6 +169,11 @@ class PersonAnswerSet(AnswerSet):
|
|||||||
blank=True,
|
blank=True,
|
||||||
null=False)
|
null=False)
|
||||||
|
|
||||||
|
#: External organisations this person has worked with
|
||||||
|
external_organisations = models.CharField(max_length=1023,
|
||||||
|
blank=True,
|
||||||
|
null=False)
|
||||||
|
|
||||||
#: Latitude for displaying location on a map
|
#: Latitude for displaying location on a map
|
||||||
latitude = models.FloatField(blank=True, null=True)
|
latitude = models.FloatField(blank=True, null=True)
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
<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 %}
|
||||||
|
|
||||||
|
{% if answer_set.external_organisations %}
|
||||||
|
<tr><td>External Organisations Worked With</td><td>{{ answer_set.external_organisations }}</td></tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for answer in answer_set.question_answers.all %}
|
{% for answer in answer_set.question_answers.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ answer.question }}</td>
|
<td>{{ answer.question }}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user