diff --git a/batadasen/models.py b/batadasen/models.py index 27cd690..1c65fe3 100644 --- a/batadasen/models.py +++ b/batadasen/models.py @@ -94,6 +94,12 @@ def full_name(self): else: return '{} "{}" {}'.format(self.first_name, self.spex_name, self.last_name) + @property + def productions(self): + memberships = self.production_memberships.select_related("group__production") + return {membership.group.production for membership in memberships} + + def __str__(self): return '({}) {}'.format(self.member_number, self.full_name) diff --git a/batadasen/templates/batadasen/person_detail.html b/batadasen/templates/batadasen/person_detail.html index 6e84ab3..eeff4e3 100644 --- a/batadasen/templates/batadasen/person_detail.html +++ b/batadasen/templates/batadasen/person_detail.html @@ -124,4 +124,20 @@
Aktiva spexår | ++ |
---|---|
Antal uppsättningar | +{{ object.productions | length }} | +
Antal föreställningar | +{{ object.performances.all | length }} | +