refactor: allow admin config of static questions

Text and visibility set in admin panel are now respected everywhere
This commit is contained in:
James Graham
2021-03-19 15:36:09 +00:00
parent 74fffb0cac
commit 81598ea624
15 changed files with 184 additions and 169 deletions

View File

@@ -36,9 +36,7 @@ class RelationshipQuestionChoice(QuestionChoice):
class Relationship(models.Model):
"""
A directional relationship between two people allowing linked questions.
"""
"""A directional relationship between two people allowing linked questions."""
class Meta:
constraints = [
models.UniqueConstraint(fields=['source', 'target'],
@@ -95,6 +93,8 @@ class Relationship(models.Model):
class RelationshipAnswerSet(AnswerSet):
"""The answers to the relationship questions at a particular point in time."""
question_model = RelationshipQuestion
#: Relationship to which this answer set belongs
relationship = models.ForeignKey(Relationship,
on_delete=models.CASCADE,
@@ -176,6 +176,8 @@ class OrganisationRelationship(models.Model):
class OrganisationRelationshipAnswerSet(AnswerSet):
"""The answers to the organisation relationship questions at a particular point in time."""
question_model = OrganisationRelationshipQuestion
#: OrganisationRelationship to which this answer set belongs
relationship = models.ForeignKey(OrganisationRelationship,
on_delete=models.CASCADE,