diff --git a/src/character/templates/character/character_details.html b/src/character/templates/character/character_details.html index ab71180..67cfd41 100644 --- a/src/character/templates/character/character_details.html +++ b/src/character/templates/character/character_details.html @@ -7,14 +7,19 @@ {% block content %}

{{ character.name }}

+

+ Joueur : {{ character.player.get_full_name|default:character.player.username }} +

+ {% if party %} +

+ Groupe : {{ party }}. Joueurs : {% for other in party.characters.all %}{{ other }}{% if not forloop.last %}, {% endif %}{% endfor %} +

+ {% endif %} {% if character|managed_by:user %}

Edit

{% endif %} -

- Joueur : {{ character.player.get_full_name|default:character.player.username }} -

{{ character.race.name }} {{ character.profile.name }} niv. {{ character.level }}
{{ character.get_gender_display }}, {{ character.age }} ans, {{ character.height_m }}m, {{ character.weight }}kg (IMC: {{ character.imc|floatformat }}) diff --git a/src/character/templates/character/snippets/characters_list/character_card.html b/src/character/templates/character/snippets/characters_list/character_card.html index 2c78d14..5290895 100644 --- a/src/character/templates/character/snippets/characters_list/character_card.html +++ b/src/character/templates/character/snippets/characters_list/character_card.html @@ -24,7 +24,7 @@

{% if character.player == user %} - + Jouer {% if party %} @@ -42,11 +42,11 @@ {% endif %} {% endif %} {% elif character|managed_by:user %} - + GĂ©rer {% else %} - + Observer {% endif %} diff --git a/src/character/views.py b/src/character/views.py index 35b05b8..4ecd665 100644 --- a/src/character/views.py +++ b/src/character/views.py @@ -6,6 +6,7 @@ from django_htmx.http import trigger_client_event from character.forms import AddPathForm, EquipmentForm from character.models import Capability, Character, HarmfulState, Path from character.templatetags.character_extras import modifier +from party.models import Party @login_required @@ -38,6 +39,12 @@ def character_view(request, pk: int): "add_path_form": add_path_form, "all_states": HarmfulState.objects.all(), } + party_pk = request.GET.get("party") + if party_pk: + context["party"] = get_object_or_404( + Party.objects.related_to(request.user).prefetch_related("characters"), + pk=party_pk, + ) return render(request, "character/character_details.html", context)