mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user