feat: add page for updating the exclusion reason where it's not set yet
This commit is contained in:
@@ -19,53 +19,10 @@
|
|||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<div class="card">
|
{% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %}
|
||||||
<div class="card-header">
|
|
||||||
<h1 class="card-header-title">{{ org.name }}</h1>
|
|
||||||
</div>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="block">
|
|
||||||
<b><i class="fa-solid fa-location-dot"></i></b>
|
|
||||||
{% if org.location %}
|
|
||||||
{{ org.location }}
|
|
||||||
{% else %}
|
|
||||||
{{ org.location_string }}
|
|
||||||
{% endif %}
|
|
||||||
{% if org.description %}
|
|
||||||
<div class="block content">
|
|
||||||
<p>{{ org.description | render_markdown }}</p>
|
|
||||||
</div>
|
|
||||||
{% 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 %}
|
|
||||||
{% if org.parent_org %}
|
|
||||||
<div class="block">
|
|
||||||
<h3 class="title is-5">{% translate 'Übergeordnete Organisation' %}</h3>
|
|
||||||
<p>
|
|
||||||
<span>
|
|
||||||
<i class="fa-solid fa-building fa-fw"
|
|
||||||
aria-label="{% trans 'Tierschutzorganisation' %}"></i>
|
|
||||||
<a href="{{ org.parent_org.get_absolute_url }}"> {{ org.parent_org }}</a>
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
{% include "fellchensammlung/partials/partial-rescue-organization-contact.html" %}
|
{% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}">
|
<a class="button is-warning is-fullwidth" href="{% url org_meta|admin_urlname:'change' org.pk %}">
|
||||||
|
|||||||
@@ -1,18 +1,35 @@
|
|||||||
{% extends "fellchensammlung/base.html" %}
|
{% extends "fellchensammlung/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load widget_tweaks %}
|
{% load widget_tweaks %}
|
||||||
|
{% load admin_urls %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
<title>Organisation {{ rescue_org }} von regelmäßiger Prüfung ausschließen</title>
|
<title>Organisation {{ org }} von regelmäßiger Prüfung ausschließen</title>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1 class="title is-1">Organisation {{ rescue_org }} von regelmäßiger Prüfung ausschließen</h1>
|
<h1 class="title is-1">Organisation {{ org }} von regelmäßiger Prüfung ausschließen</h1>
|
||||||
<form method="post">
|
<div class="columns block">
|
||||||
{% csrf_token %}
|
<div class="column">
|
||||||
{{ form }}
|
{% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %}
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
{% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
|
||||||
<a class="button" href="{% url 'organization-check' %}">{% translate "Zurück (nicht exkludieren)" %}</a>
|
<a class="button" href="{% url 'organization-check' %}">{% translate "Zurück (nicht exkludieren)" %}</a>
|
||||||
<input class="button is-danger" type="submit" name="delete" value="{% translate "Von regelmäßiger Prüfung ausschließen" %}">
|
<input class="button is-danger" type="submit" name="delete"
|
||||||
</form>
|
value="{% translate "Von regelmäßiger Prüfung ausschließen" %}">
|
||||||
|
</form>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
{% if rescue_organizations %}
|
{% if rescue_organizations %}
|
||||||
{% for rescue_organization in rescue_organizations %}
|
{% for rescue_organization in rescue_organizations %}
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
{% include "fellchensammlung/partials/partial-rescue-organization.html" %}
|
{% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
{% load custom_tags %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h1 class="card-header-title">{{ org.name }}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="block">
|
||||||
|
<b><i class="fa-solid fa-location-dot"></i></b>
|
||||||
|
{% if org.location %}
|
||||||
|
{{ org.location }}
|
||||||
|
{% else %}
|
||||||
|
{{ org.location_string }}
|
||||||
|
{% endif %}
|
||||||
|
{% if org.description %}
|
||||||
|
<div class="block content">
|
||||||
|
<p>{{ org.description | render_markdown }}</p>
|
||||||
|
</div>
|
||||||
|
{% 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 %}
|
||||||
|
{% if org.parent_org %}
|
||||||
|
<div class="block">
|
||||||
|
<h3 class="title is-5">{% translate 'Übergeordnete Organisation' %}</h3>
|
||||||
|
<p>
|
||||||
|
<span>
|
||||||
|
<i class="fa-solid fa-building fa-fw"
|
||||||
|
aria-label="{% trans 'Tierschutzorganisation' %}"></i>
|
||||||
|
<a href="{{ org.parent_org.get_absolute_url }}"> {{ org.parent_org }}</a>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<div class="grid is-col-min-15">
|
<div class="grid is-col-min-15">
|
||||||
{% for rescue_org in rescue_orgs_to_check %}
|
{% for rescue_org in rescue_orgs_to_check %}
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %}
|
{% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<div class="grid is-col-min-15">
|
<div class="grid is-col-min-15">
|
||||||
{% for rescue_org in rescue_orgs_with_ongoing_communication %}
|
{% for rescue_org in rescue_orgs_with_ongoing_communication %}
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %}
|
{% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<div class="grid is-col-min-15">
|
<div class="grid is-col-min-15">
|
||||||
{% for rescue_org in rescue_orgs_last_checked %}
|
{% for rescue_org in rescue_orgs_last_checked %}
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
{% include "fellchensammlung/partials/partial-check-rescue-org.html" %}
|
{% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ urlpatterns = [
|
|||||||
name="rescue-organization-detail"),
|
name="rescue-organization-detail"),
|
||||||
path("tierschutzorganisationen/<int:rescue_organization_id>/exkludieren", views.exclude_from_regular_check,
|
path("tierschutzorganisationen/<int:rescue_organization_id>/exkludieren", views.exclude_from_regular_check,
|
||||||
name="rescue-organization-exclude"),
|
name="rescue-organization-exclude"),
|
||||||
|
path("tierschutzorganisationen/add-exclusion-reason", views.update_exclusion_reason,
|
||||||
|
name="rescue-organization-add-exclusion-reason"),
|
||||||
path("tierschutzorganisationen/spezialisierung/<slug:species_slug>", views.specialized_rescues,
|
path("tierschutzorganisationen/spezialisierung/<slug:species_slug>", views.specialized_rescues,
|
||||||
name="specialized-rescue-organizations"),
|
name="specialized-rescue-organizations"),
|
||||||
|
|
||||||
|
|||||||
@@ -897,23 +897,38 @@ def rescue_organization_check_dq(request):
|
|||||||
return rescue_organization_check(request, context)
|
return rescue_organization_check(request, context)
|
||||||
|
|
||||||
|
|
||||||
@user_passes_test(user_is_trust_level_or_above)
|
def exclude_from_regular_check(request, rescue_organization_id, source="organization-check"):
|
||||||
def exclude_from_regular_check(request, rescue_organization_id):
|
|
||||||
rescue_org = get_object_or_404(RescueOrganization, pk=rescue_organization_id)
|
rescue_org = get_object_or_404(RescueOrganization, pk=rescue_organization_id)
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = UpdateRescueOrgRegularCheckStatus(request.POST, instance=rescue_org)
|
form = UpdateRescueOrgRegularCheckStatus(request.POST, instance=rescue_org)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
if form.cleaned_data["regular_check_status"] != RegularCheckStatusChoices.REGULAR_CHECK:
|
to_be_excluded = form.cleaned_data["regular_check_status"] != RegularCheckStatusChoices.REGULAR_CHECK
|
||||||
rescue_org.exclude_from_check = True
|
rescue_org.exclude_from_check = to_be_excluded
|
||||||
rescue_org.save()
|
rescue_org.save()
|
||||||
return redirect(reverse("organization-check"))
|
|
||||||
|
return redirect(reverse(source))
|
||||||
else:
|
else:
|
||||||
form = UpdateRescueOrgRegularCheckStatus(instance=rescue_org)
|
form = UpdateRescueOrgRegularCheckStatus(instance=rescue_org)
|
||||||
context = {"form": form, rescue_org: rescue_org}
|
org_meta = rescue_org._meta
|
||||||
|
context = {"form": form, "org": rescue_org, "org_meta": org_meta}
|
||||||
return render(request, 'fellchensammlung/forms/form-exclude-org-from-check.html', context=context)
|
return render(request, 'fellchensammlung/forms/form-exclude-org-from-check.html', context=context)
|
||||||
|
|
||||||
|
|
||||||
|
@user_passes_test(user_is_trust_level_or_above)
|
||||||
|
def update_exclusion_reason(request):
|
||||||
|
"""
|
||||||
|
This view will redirect to update a rescue org that not yet has an exclusion reason but is excluded
|
||||||
|
"""
|
||||||
|
orgs_to_check = RescueOrganization.objects.filter(exclude_from_check=True,
|
||||||
|
regular_check_status=RegularCheckStatusChoices.REGULAR_CHECK)
|
||||||
|
if orgs_to_check.count() > 0:
|
||||||
|
return exclude_from_regular_check(request, orgs_to_check[0].pk,
|
||||||
|
source="rescue-organization-add-exclusion-reason")
|
||||||
|
else:
|
||||||
|
return render(request, "fellchensammlung/errors/404.html", status=404)
|
||||||
|
|
||||||
|
|
||||||
@user_passes_test(user_is_trust_level_or_above)
|
@user_passes_test(user_is_trust_level_or_above)
|
||||||
def moderation_tools_overview(request):
|
def moderation_tools_overview(request):
|
||||||
context = None
|
context = None
|
||||||
|
|||||||
Reference in New Issue
Block a user