From b16cf76208880bd09cb7d8dae6dba0b3065238a1 Mon Sep 17 00:00:00 2001 From: moanos Date: Sat, 8 Jun 2024 22:11:55 +0200 Subject: [PATCH] feat: Add user page to show adoption notices --- .../details/detail-member.html | 16 --------------- .../fellchensammlung/details/detail-user.html | 20 +++++++++++++++++++ .../templates/fellchensammlung/header.html | 2 +- src/fellchensammlung/views.py | 6 +++--- 4 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 src/fellchensammlung/templates/fellchensammlung/details/detail-member.html create mode 100644 src/fellchensammlung/templates/fellchensammlung/details/detail-user.html diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-member.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-member.html deleted file mode 100644 index dc58f55..0000000 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail-member.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "fellchensammlung/base_generic.html" %} -{% load i18n %} - -{% block content %} -

{{ member.user.get_full_name }}

- -

{% translate "Username" %}: {{ member.user.username }}

-

{% translate "E-Mail" %}: {{ member.user.email }}

- - {% if member.preferred_language %} -

{% translate "Sprache" %}: {{ member.preferred_language }}

- {% else %} -

{% translate "Keine bevorzugte Sprache gesetzt." %}

- {% endif %} - -{% endblock %} \ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html new file mode 100644 index 0000000..d161d16 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-user.html @@ -0,0 +1,20 @@ +{% extends "fellchensammlung/base_generic.html" %} +{% load i18n %} + +{% block content %} +

{{ user.get_full_name }}

+ +

{% translate "Username" %}: {{ user.username }}

+

{% translate "E-Mail" %}: {{ user.email }}

+ + {% if user.preferred_language %} +

{% translate "Sprache" %}: {{ user.preferred_language }}

+ {% else %} +

{% translate "Keine bevorzugte Sprache gesetzt." %}

+ {% endif %} + + {% if user.id is request.user.id %} +

{% translate 'Meine Vermittlungen' %}

+ {% include "fellchensammlung/lists/list-adoption-notices.html" %} + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/header.html b/src/fellchensammlung/templates/fellchensammlung/header.html index 50a3c60..d03fe3c 100644 --- a/src/fellchensammlung/templates/fellchensammlung/header.html +++ b/src/fellchensammlung/templates/fellchensammlung/header.html @@ -16,7 +16,7 @@
{% if user.is_authenticated %}
-

{{ user.username }}

+

{{ user.username }}

{% csrf_token %} diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index c12b1e3..0b809f7 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -303,9 +303,9 @@ def report_detail_success(request, report_id): def user_detail(request, user_id): - member = Member.objects.get(id=user_id) - context = {"member": member} - return render(request, 'fellchensammlung/details/detail-member.html', context=context) + user = User.objects.get(id=user_id) + context = {"user": user, "adoption_notices": AdoptionNotice.objects.filter(created_by=user)} + return render(request, 'fellchensammlung/details/detail-user.html', context=context) def modqueue(request):