From 6c52246bb76e1839d4517480279b831cb47de386 Mon Sep 17 00:00:00 2001 From: moanos Date: Thu, 14 Nov 2024 19:16:47 +0100 Subject: [PATCH] feat: Add detail view for organizations --- .../details/detail-rescue-organization.html | 19 +++++++++++++++++++ src/fellchensammlung/urls.py | 2 ++ src/fellchensammlung/views.py | 8 +++++++- src/notfellchen/urls.py | 4 ++-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html new file mode 100644 index 0000000..a84848c --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html @@ -0,0 +1,19 @@ +{% extends "fellchensammlung/base_generic.html" %} +{% load custom_tags %} +{% load i18n %} + +{% block title %}{{ org.name }}{% endblock %} + +{% block content %} +
+

{{ org.name }}

+ + + {% if org.location %} + {{ org.location.str_hr }} + {% else %} + {{ org.location_string }} + {% endif %} +

{{ org.description | render_markdown }}

+
+{% endblock %} diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py index 64c7ab1..4a04614 100644 --- a/src/fellchensammlung/urls.py +++ b/src/fellchensammlung/urls.py @@ -24,6 +24,8 @@ urlpatterns = [ path("vermittlung//add-photo", views.add_photo_to_adoption_notice, name="adoption-notice-add-photo"), # ex: /adoption_notice/2/add-animal path("vermittlung//add-animal", views.adoption_notice_add_animal, name="adoption-notice-add-animal"), + path("organisation//", views.detail_view_rescue_organization, + name="rescue-organization-detail"), # ex: /search/ path("suchen/", views.search, name="search"), diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index f54f4e2..91b5fa8 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -148,7 +148,8 @@ def adoption_notice_edit(request, adoption_notice_id): adoption_notice_instance.save() """Log""" - Log.objects.create(user=request.user, action="adoption_notice_edit", text=f"{request.user} hat Vermittlung {adoption_notice.pk} geändert") + Log.objects.create(user=request.user, action="adoption_notice_edit", + text=f"{request.user} hat Vermittlung {adoption_notice.pk} geändert") return redirect(reverse("adoption-notice-detail", args=[adoption_notice_instance.pk], )) else: form = AdoptionNoticeForm(instance=adoption_notice) @@ -541,3 +542,8 @@ def external_site_warning(request): context.update(texts) return render(request, 'fellchensammlung/external_site_warning.html', context=context) + + +def detail_view_rescue_organization(request, rescue_organization_id): + org = RescueOrganization.objects.get(pk=rescue_organization_id) + return render(request, 'fellchensammlung/details/detail-rescue-organization.html', context={"org": org}) diff --git a/src/notfellchen/urls.py b/src/notfellchen/urls.py index c85176c..276cc7b 100644 --- a/src/notfellchen/urls.py +++ b/src/notfellchen/urls.py @@ -25,9 +25,9 @@ urlpatterns = [ path('admin/', admin.site.urls), ] -urlpatterns += i18n_patterns ( +urlpatterns += i18n_patterns( path("", include("fellchensammlung.urls")), - prefix_default_language = False + prefix_default_language=False ) if settings.DEBUG: