feat: add negative response flag to question models

This commit is contained in:
James Graham
2022-03-31 18:48:18 +01:00
parent 183c8706b6
commit c50bdca3eb
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# Generated by Django 2.2.10 on 2022-03-31 17:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('people', '0053_organisation_order_name'),
]
operations = [
migrations.AddField(
model_name='organisationquestionchoice',
name='is_negative_response',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='organisationrelationshipquestionchoice',
name='is_negative_response',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='personquestionchoice',
name='is_negative_response',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='relationshipquestionchoice',
name='is_negative_response',
field=models.BooleanField(default=False),
),
]

View File

@@ -114,6 +114,9 @@ class QuestionChoice(models.Model):
#: Position of this answer in the list
order = models.SmallIntegerField(default=0, blank=False, null=False)
#: Does this answer represent the negative response?
is_negative_response = models.BooleanField(default=False)
@property
def slug(self) -> str:
return slugify(self.text)