feat(people): Add detail views for Person and Relationship

This commit is contained in:
James Graham
2020-02-18 14:38:41 +00:00
parent 026fc10999
commit 4b2abd5d6c
6 changed files with 161 additions and 0 deletions

View File

@@ -29,6 +29,12 @@ class Person(models.Model):
through='Relationship',
through_fields=('source', 'target'),
symmetrical=False)
@property
def relationships(self):
return self.relationships_as_source.all().union(
self.relationships_as_target.all()
)
def __str__(self) -> str:
return self.name