From 7820021864fe39c20f6deba708e91f7f21a4b04a Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Thu, 2 Jan 2020 04:27:24 +0100 Subject: [PATCH] Show user ranks in raid details. --- drakul/raids/models.py | 2 +- drakul/raids/templates/raids/raid_detail.html | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drakul/raids/models.py b/drakul/raids/models.py index b696db2..e11709d 100755 --- a/drakul/raids/models.py +++ b/drakul/raids/models.py @@ -93,7 +93,7 @@ class RaidResponse(models.Model): ) class Meta: - ordering = ["-status", "role", "character__klass", "character__name"] + ordering = ["-status", "role", "character__klass", "character__user__rank", "character__name"] constraints = [ models.UniqueConstraint(fields=["raid", "character"], name="unique_character_raid_signup") ] diff --git a/drakul/raids/templates/raids/raid_detail.html b/drakul/raids/templates/raids/raid_detail.html index 17dbce2..7f3d890 100644 --- a/drakul/raids/templates/raids/raid_detail.html +++ b/drakul/raids/templates/raids/raid_detail.html @@ -70,14 +70,22 @@ {% regroup role_responses by character.klass as class_responses_list %} {% for class, class_responses in class_responses_list %}
- {% for response in class_responses %} - - {% if response.character != response.character.user.main %} - {{ response.character.name }} - {% else %} - {{ response.character.name }} - {% endif %} - + {% regroup class_responses by character.user.rank as rank_responses_list %} + {% for rank, rank_responses in rank_responses_list %} +
+
+
{{ rank }}
+
+
+ {% for response in rank_responses %} + + {% if response.character != response.character.user.main %} + {{ response.character.name }} + {% else %} + {{ response.character.name }} + {% endif %} + + {% endfor %} {% endfor %}
{% endfor %}