Fix condition check for musikgame existence in group detail template; add results section in musikgame detail template; update order range in GameCreateView
This commit is contained in:
parent
78e5be580b
commit
c320015205
3 changed files with 36 additions and 2 deletions
|
@ -18,7 +18,7 @@
|
|||
<a href="{% url "group_clear_blacklist" pk=group.pk %}" role="button"><i class="ri-history-fill"></i> Effacer la blacklist</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if group.musikgame_set %}
|
||||
{% if group.musikgame_set.exists %}
|
||||
<h2>
|
||||
<i class="ri-play-circle-fill"></i> Parties
|
||||
</h2>
|
||||
|
|
|
@ -24,4 +24,38 @@
|
|||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<h2>
|
||||
<i class="ri-list-ordered"></i> Résultats
|
||||
</h2>
|
||||
<details>
|
||||
<summary role="button">
|
||||
<i class="ri-list-ordered-2"></i> Résultats
|
||||
</summary>
|
||||
<table class="striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<i class="ri-list-ordered-2"></i>
|
||||
</th>
|
||||
<th>
|
||||
<i class="ri-music-2-fill"></i> Musique
|
||||
</th>
|
||||
<th>
|
||||
<i class="ri-user-line"></i> Joueur
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for music in musikgame.musicgameorder_set.all %}
|
||||
<tr>
|
||||
<td>{{ music.order }}</td>
|
||||
<td>
|
||||
<a href="https://youtu.be/{{ music.music_video.yt_id }}">{{ music.music_video.title }}</a>
|
||||
</td>
|
||||
<td>{{ music.player }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</details>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -170,7 +170,7 @@ class GameCreateView(LoginRequiredMixin, CreateView):
|
|||
|
||||
pm_list = list(zip(players, musics))
|
||||
random.shuffle(pm_list)
|
||||
for (player, music), order in zip(pm_list, range(len(pm_list))):
|
||||
for (player, music), order in zip(pm_list, range(1, len(pm_list) + 1)):
|
||||
music.blacklisted = True
|
||||
music.save()
|
||||
models.MusicGameOrder.objects.create(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue