feat: add configurable help text to questions

This commit is contained in:
James Graham
2021-03-10 09:48:44 +00:00
parent e3e8a2ada4
commit af31971565
3 changed files with 64 additions and 3 deletions

View File

@@ -76,7 +76,8 @@ class DynamicAnswerSetBase(forms.Form):
widget=field_widget, widget=field_widget,
required=(self.field_required required=(self.field_required
and not question.allow_free_text), and not question.allow_free_text),
initial=initial.get(field_name, None)) 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)

View File

@@ -0,0 +1,53 @@
# Generated by Django 2.2.10 on 2021-03-10 09:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('people', '0044_themes_to_admin_question'),
]
operations = [
migrations.AddField(
model_name='organisationquestion',
name='help_text',
field=models.CharField(blank=True, help_text='Additional hint text to be displayed with the question', max_length=255),
),
migrations.AddField(
model_name='organisationrelationshipquestion',
name='help_text',
field=models.CharField(blank=True, help_text='Additional hint text to be displayed with the question', max_length=255),
),
migrations.AddField(
model_name='personquestion',
name='help_text',
field=models.CharField(blank=True, help_text='Additional hint text to be displayed with the question', max_length=255),
),
migrations.AddField(
model_name='relationshipquestion',
name='help_text',
field=models.CharField(blank=True, help_text='Additional hint text to be displayed with the question', max_length=255),
),
migrations.AlterField(
model_name='organisationquestion',
name='filter_text',
field=models.CharField(blank=True, help_text='Alternative text to be displayed in network filters - 3rd person', max_length=255),
),
migrations.AlterField(
model_name='organisationrelationshipquestion',
name='filter_text',
field=models.CharField(blank=True, help_text='Alternative text to be displayed in network filters - 3rd person', max_length=255),
),
migrations.AlterField(
model_name='personquestion',
name='filter_text',
field=models.CharField(blank=True, help_text='Alternative text to be displayed in network filters - 3rd person', max_length=255),
),
migrations.AlterField(
model_name='relationshipquestion',
name='filter_text',
field=models.CharField(blank=True, help_text='Alternative text to be displayed in network filters - 3rd person', max_length=255),
),
]

View File

@@ -27,12 +27,19 @@ class Question(models.Model):
#: Text of question - 1st person #: Text of question - 1st person
text = models.CharField(max_length=255, blank=False, null=False) text = models.CharField(max_length=255, blank=False, null=False)
#: Text to be displayed in network filters - 3rd person #: Alternative text to be displayed in network filters - 3rd person
filter_text = models.CharField( filter_text = models.CharField(
max_length=255, max_length=255,
blank=True, blank=True,
null=False, null=False,
help_text='Text to be displayed in network filters - 3rd person') help_text='Alternative text to be displayed in network filters - 3rd person')
help_text = models.CharField(
help_text='Additional hint text to be displayed with the question',
max_length=255,
blank=True,
null=False
)
#: Should answers to this question be considered public? #: Should answers to this question be considered public?
answer_is_public = models.BooleanField( answer_is_public = models.BooleanField(