feat: Add user page to show adoption notices

This commit is contained in:
moanos [he/him] 2024-06-08 22:11:55 +02:00
parent bbb2d33840
commit b16cf76208
4 changed files with 24 additions and 20 deletions

View File

@ -1,16 +0,0 @@
{% extends "fellchensammlung/base_generic.html" %}
{% load i18n %}
{% block content %}
<h1>{{ member.user.get_full_name }}</h1>
<p><strong>{% translate "Username" %}:</strong> {{ member.user.username }}</p>
<p><strong>{% translate "E-Mail" %}:</strong> {{ member.user.email }}</p>
{% if member.preferred_language %}
<p><strong>{% translate "Sprache" %}:</strong> {{ member.preferred_language }}</p>
{% else %}
<p>{% translate "Keine bevorzugte Sprache gesetzt." %}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends "fellchensammlung/base_generic.html" %}
{% load i18n %}
{% block content %}
<h1>{{ user.get_full_name }}</h1>
<p><strong>{% translate "Username" %}:</strong> {{ user.username }}</p>
<p><strong>{% translate "E-Mail" %}:</strong> {{ user.email }}</p>
{% if user.preferred_language %}
<p><strong>{% translate "Sprache" %}:</strong> {{ user.preferred_language }}</p>
{% else %}
<p>{% translate "Keine bevorzugte Sprache gesetzt." %}</p>
{% endif %}
{% if user.id is request.user.id %}
<h2>{% translate 'Meine Vermittlungen' %}</h2>
{% include "fellchensammlung/lists/list-adoption-notices.html" %}
{% endif %}
{% endblock %}

View File

@ -16,7 +16,7 @@
<div class="header-right">
{% if user.is_authenticated %}
<div class="profile-card">
<p>{{ user.username }}</p>
<p><a href="{{ user.get_absolute_url }}">{{ user.username }}</a></p>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">{% translate "Ausloggen" %}</button>

View File

@ -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):