feat: Add detail view for organizations

This commit is contained in:
moanos [he/him] 2024-11-14 19:16:47 +01:00
parent 2c11f7c385
commit 6c52246bb7
4 changed files with 30 additions and 3 deletions

View File

@ -0,0 +1,19 @@
{% extends "fellchensammlung/base_generic.html" %}
{% load custom_tags %}
{% load i18n %}
{% block title %}<title>{{ org.name }}</title>{% endblock %}
{% block content %}
<div class="card">
<h1>{{ org.name }}</h1>
<b><i class="fa-solid fa-location-dot"></i></b>
{% if org.location %}
{{ org.location.str_hr }}
{% else %}
{{ org.location_string }}
{% endif %}
<p>{{ org.description | render_markdown }}</p>
</div>
{% endblock %}

View File

@ -24,6 +24,8 @@ urlpatterns = [
path("vermittlung/<int:adoption_notice_id>/add-photo", views.add_photo_to_adoption_notice, name="adoption-notice-add-photo"),
# ex: /adoption_notice/2/add-animal
path("vermittlung/<int:adoption_notice_id>/add-animal", views.adoption_notice_add_animal, name="adoption-notice-add-animal"),
path("organisation/<int:rescue_organization_id>/", views.detail_view_rescue_organization,
name="rescue-organization-detail"),
# ex: /search/
path("suchen/", views.search, name="search"),

View File

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

View File

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