diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html
index 38c7b32..5c2bf24 100644
--- a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html
+++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html
@@ -35,6 +35,18 @@
{{ org.description | render_markdown }}
{% endif %}
+ {% if org.specializations %}
+
+
{% translate 'Spezialisierung' %}
+
+
+ {% for specialization in org.specializations.all %}
+ - {{ specialization }}
+ {% endfor %}
+
+
+
+ {% endif %}
@@ -42,7 +54,8 @@
{% include "fellchensammlung/partials/partial-rescue-organization-contact.html" %}
diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py
index d40327e..0a2c37e 100644
--- a/src/fellchensammlung/urls.py
+++ b/src/fellchensammlung/urls.py
@@ -43,6 +43,8 @@ urlpatterns = [
path("tierschutzorganisationen/", views.list_rescue_organizations, name="rescue-organizations"),
path("tierschutzorganisationen//", views.detail_view_rescue_organization,
name="rescue-organization-detail"),
+ path("tierschutzorganisationen/spezialisierung/", views.specialized_rescues,
+ name="specialized-rescue-organizations"),
# ex: /search/
path("suchen/", views.search, name="search"),
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py
index f37fcc6..da5b146 100644
--- a/src/fellchensammlung/views.py
+++ b/src/fellchensammlung/views.py
@@ -741,8 +741,12 @@ def external_site_warning(request, template_name='fellchensammlung/external-site
return render(request, template_name, context=context)
-def list_rescue_organizations(request, template='fellchensammlung/animal-shelters.html'):
- rescue_organizations = RescueOrganization.objects.all()
+def list_rescue_organizations(request, species=None, template='fellchensammlung/animal-shelters.html'):
+ if species is None:
+ rescue_organizations = RescueOrganization.objects.all()
+ else:
+ rescue_organizations = RescueOrganization.objects.filter(specializations=species)
+
paginator = Paginator(rescue_organizations, 10)
page_number = request.GET.get("page")
@@ -761,6 +765,11 @@ def list_rescue_organizations(request, template='fellchensammlung/animal-shelter
return render(request, template, context=context)
+def specialized_rescues(request, species_id):
+ species = get_object_or_404(Species, pk=species_id)
+ return list_rescue_organizations(request, species)
+
+
def detail_view_rescue_organization(request, rescue_organization_id,
template='fellchensammlung/details/detail-rescue-organization.html'):
org = RescueOrganization.objects.get(pk=rescue_organization_id)
@@ -808,8 +817,10 @@ def rescue_organization_check(request, context=None):
if comment_form.is_valid():
comment_form.save()
- rescue_orgs_to_check = RescueOrganization.objects.filter(exclude_from_check=False, ongoing_communication=False).order_by("last_checked")[:3]
- rescue_orgs_with_ongoing_communication = RescueOrganization.objects.filter(ongoing_communication=True).order_by("updated_at")
+ rescue_orgs_to_check = RescueOrganization.objects.filter(exclude_from_check=False,
+ ongoing_communication=False).order_by("last_checked")[:3]
+ rescue_orgs_with_ongoing_communication = RescueOrganization.objects.filter(ongoing_communication=True).order_by(
+ "updated_at")
rescue_orgs_last_checked = RescueOrganization.objects.filter().order_by("-last_checked")[:10]
rescue_orgs_to_comment = rescue_orgs_to_check | rescue_orgs_with_ongoing_communication | rescue_orgs_last_checked
# Prepare a form for each organization
@@ -862,5 +873,5 @@ def deactivate_an(request, adoption_notice_id):
reason_for_closing = request.POST.get("reason_for_closing")
adoption_notice.set_closed(reason_for_closing)
return redirect(reverse("adoption-notice-detail", args=[adoption_notice.pk], ))
- context = {"adoption_notice": adoption_notice,}
- return render(request, 'fellchensammlung/misc/deactivate-an.html', context=context)
\ No newline at end of file
+ context = {"adoption_notice": adoption_notice, }
+ return render(request, 'fellchensammlung/misc/deactivate-an.html', context=context)