feat(people): Display relationship answers on detail page

resolve #5
This commit is contained in:
James Graham
2020-02-20 15:24:48 +00:00
parent 5a1b043862
commit e4a50dbfa4
3 changed files with 66 additions and 5 deletions

View File

@@ -97,6 +97,7 @@ class RelationshipQuestionChoice(models.Model):
name='unique_question_answer')
]
ordering = [
'question__order',
'order',
'text',
]
@@ -147,3 +148,13 @@ class Relationship(models.Model):
def __str__(self) -> str:
return f'{self.source} -> {self.target}'
@property
def reverse(self):
"""
Get the reverse of this relationship.
@raise Relationship.DoesNotExist: When the reverse relationship is not known
"""
return type(self).objects.get(source=self.target,
target=self.source)