add tournament_status_display method

clubs
Razmig Sarkissian 1 year ago
parent 6e95a8acbc
commit e9c819cec8
  1. 5
      tournaments/models/tournament.py
  2. 8
      tournaments/templates/tournaments/tournament_row.html

@ -124,7 +124,10 @@ class Tournament(models.Model):
else:
return None
def team_count_display(self):
def tournament_status_display(self):
if self.is_canceled:
return "Annulé"
teams = self.teams()
if teams is not None and len(teams) > 0:
return f"{len(teams)} inscriptions"

@ -22,13 +22,13 @@
{% endif %}
</div>
{% if tournament.team_count_display %}
<div class="table-cell-responsive-large center horizontal-padding">{{ tournament.team_count_display }}</div>
{% if tournament.tournament_status_display %}
<div class="table-cell-responsive-large center horizontal-padding">{{ tournament.tournament_status_display }}</div>
{% endif %}
<div class="table-cell">
<div class="mybox center">{{ tournament.formatted_start_date }}</div>
{% if tournament.team_count_display %}
<div class="table-cell-responsive-short small center">{{ tournament.team_count_display }}</div>
{% if tournament.tournament_status_display %}
<div class="table-cell-responsive-short small center">{{ tournament.tournament_status_display }}</div>
{% endif %}
</div>
</div>

Loading…
Cancel
Save