Skip to content

Commit

Permalink
WIP: Show summary on user page
Browse files Browse the repository at this point in the history
This commit will be rewritten.

Part of #63
  • Loading branch information
jonatanskogsfors committed Sep 12, 2024
1 parent 8b26cb5 commit 939186e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions batadasen/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 16 additions & 0 deletions batadasen/templates/batadasen/person_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,20 @@ <h2>Medlemskapshistorik</h2>
</tr>
{% endfor %}
</table>

<h2>Sammanfattning</h2>
<table class="table table-sm col-3">
<tr>
<th class="table-active">Aktiva spexår</th>
<td class="text-right"></td>
</tr>
<tr>
<th class="table-active">Antal uppsättningar</th>
<td class="text-right">{{ object.productions | length }}</td>
</tr>
<tr>
<th class="table-active">Antal föreställningar</th>
<td class="text-right">{{ object.performances.all | length }}</td>
</tr>
</table>
{% endblock %}

0 comments on commit 939186e

Please sign in to comment.