feat: Add view for specialized rescues
This commit is contained in:
@@ -35,6 +35,18 @@
|
||||
<p>{{ org.description | render_markdown }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if org.specializations %}
|
||||
<div class="block">
|
||||
<h3 class="title is-5">{% translate 'Spezialisierung' %}</h3>
|
||||
<div class="content">
|
||||
<ul>
|
||||
{% for specialization in org.specializations.all %}
|
||||
<li>{{ specialization }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,7 +54,8 @@
|
||||
{% include "fellchensammlung/partials/partial-rescue-organization-contact.html" %}
|
||||
</div>
|
||||
<div class="block">
|
||||
<a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}"><i class="fa-solid fa-tools fa-fw"></i> Admin interface</a>
|
||||
<a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}"><i
|
||||
class="fa-solid fa-tools fa-fw"></i> Admin interface</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
|
@@ -43,6 +43,8 @@ urlpatterns = [
|
||||
path("tierschutzorganisationen/", views.list_rescue_organizations, name="rescue-organizations"),
|
||||
path("tierschutzorganisationen/<int:rescue_organization_id>/", views.detail_view_rescue_organization,
|
||||
name="rescue-organization-detail"),
|
||||
path("tierschutzorganisationen/spezialisierung/<int:species_id>", views.specialized_rescues,
|
||||
name="specialized-rescue-organizations"),
|
||||
|
||||
# ex: /search/
|
||||
path("suchen/", views.search, name="search"),
|
||||
|
@@ -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)
|
||||
context = {"adoption_notice": adoption_notice, }
|
||||
return render(request, 'fellchensammlung/misc/deactivate-an.html', context=context)
|
||||
|
Reference in New Issue
Block a user