mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
@@ -171,7 +171,7 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
|
|||||||
'longitude',
|
'longitude',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'nationality': Select2Widget(),
|
'nationality': Select2MultipleWidget(),
|
||||||
'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'),
|
'project_started_date': DatePickerInput(format='%Y-%m-%d'),
|
||||||
|
|||||||
20
people/migrations/0052_allow_multiple_nationalities.py
Normal file
20
people/migrations/0052_allow_multiple_nationalities.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 2.2.10 on 2021-03-19 15:39
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
import django_countries.fields
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('people', '0051_refactor_hardcoded_questions'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='personanswerset',
|
||||||
|
name='nationality',
|
||||||
|
field=django_countries.fields.CountryField(blank=True, default=[], max_length=746, multiple=True),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -147,7 +147,7 @@ class PersonAnswerSet(AnswerSet):
|
|||||||
##################
|
##################
|
||||||
# Static questions
|
# Static questions
|
||||||
|
|
||||||
nationality = CountryField(blank=True, null=True)
|
nationality = CountryField(multiple=True, blank=True)
|
||||||
|
|
||||||
country_of_residence = CountryField(blank=True, null=True)
|
country_of_residence = CountryField(blank=True, null=True)
|
||||||
|
|
||||||
|
|||||||
@@ -176,8 +176,11 @@ class AnswerSet(models.Model):
|
|||||||
try:
|
try:
|
||||||
for question in questions:
|
for question in questions:
|
||||||
if question.hardcoded_field:
|
if question.hardcoded_field:
|
||||||
question_answers[question.text] = getattr(
|
answer = getattr(self, question.hardcoded_field)
|
||||||
self, question.hardcoded_field)
|
if isinstance(answer, list):
|
||||||
|
answer = ', '.join(map(str, answer))
|
||||||
|
|
||||||
|
question_answers[question.text] = answer
|
||||||
|
|
||||||
else:
|
else:
|
||||||
answers = self.question_answers.filter(
|
answers = self.question_answers.filter(
|
||||||
|
|||||||
Reference in New Issue
Block a user