diff --git a/visualiser/tournament/models.py b/visualiser/tournament/models.py index 4ecc6c1..5fca804 100644 --- a/visualiser/tournament/models.py +++ b/visualiser/tournament/models.py @@ -679,6 +679,12 @@ def round_scoring_system_obj(self): raise InvalidScoringSystem(self.round_scoring_system) return system + def non_power_awards(self): + """ + Returns a QuerySet of all awards other than "Best Country" awards. + """ + return self.awards.filter(power=None) + def award_number(self, award): """ Returns the number (1..n) for the specified (non-best country) award at the tournament diff --git a/visualiser/tournament/templates/tournaments/awards.html b/visualiser/tournament/templates/tournaments/awards.html index 02618bc..5a26d0f 100644 --- a/visualiser/tournament/templates/tournaments/awards.html +++ b/visualiser/tournament/templates/tournaments/awards.html @@ -5,6 +5,13 @@ {% block content %}

{{ tournament }} {% trans "Awards" %}

+{% if numbered_list %} +
    + {% for a in tournament.non_power_awards %} +
  1. {{ a }}
  2. + {% endfor %} +
+{% else %}
{% if tournament.is_finished %} {% for tp in tournament.tournamentplayer_set.all %} @@ -24,4 +31,5 @@

{{ tournament }} {% trans "A {% endfor %} {% endif %}

+{% endif %} {% endblock %} diff --git a/visualiser/tournament/templates/tournaments/detail.html b/visualiser/tournament/templates/tournaments/detail.html index 82642de..3d8e0ab 100644 --- a/visualiser/tournament/templates/tournaments/detail.html +++ b/visualiser/tournament/templates/tournaments/detail.html @@ -68,10 +68,11 @@

{{ tournament }}

  • {% trans "Round Index" %}
  • {% if tournament.is_finished %} -

    {% trans "CSV files for World Diplomacy Database upload:" %}

    +

    {% trans "Information for adding the tournament to the World Diplomacy Database:" %}

    {% endif %} {% if user.is_active and tournament.editable %} diff --git a/visualiser/tournament/test_tournament_views.py b/visualiser/tournament/test_tournament_views.py index aa32322..517d793 100644 --- a/visualiser/tournament/test_tournament_views.py +++ b/visualiser/tournament/test_tournament_views.py @@ -934,3 +934,11 @@ def test_enter_awards_post(self): self.assertEqual(a.tournamentplayer_set.count(), 1) # Cleanup tp.awards.clear() + + + def test_tournament_wdd_awards(self): + # Should be viewable without logging in + response = self.client.get(reverse('tournament_wdd_awards', + args=(self.t1.pk,)), + secure=True) + self.assertEqual(response.status_code, 200) diff --git a/visualiser/tournament/urls.py b/visualiser/tournament/urls.py index 0a1972c..d708a60 100644 --- a/visualiser/tournament/urls.py +++ b/visualiser/tournament/urls.py @@ -229,7 +229,11 @@ def to_url(self, value): path('player_prefs//', tournament_player_views.player_prefs, name='player_prefs'), path('awards/', tournament_views.tournament_simple, - {'template': 'awards'}, name='tournament_awards'), + {'template': 'awards', 'context': {'numbered_list': False}}, + name='tournament_awards'), + path('wdd_awards/', tournament_views.tournament_simple, + {'template': 'awards', 'context': {'numbered_list': True}}, + name='tournament_wdd_awards'), path('enter_awards/', tournament_views.enter_awards, name='enter_awards'), path('players/', include(tp_patterns)), path('rounds//', include(round_patterns)),