diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html index c39b27b..29d9a0d 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html @@ -19,53 +19,10 @@
-
-
-

{{ org.name }}

-
-
-
- - {% if org.location %} - {{ org.location }} - {% else %} - {{ org.location_string }} - {% endif %} - {% if org.description %} -
-

{{ org.description | render_markdown }}

-
- {% endif %} -
- {% if org.specializations %} -
-

{% translate 'Spezialisierung' %}

-
-
    - {% for specialization in org.specializations.all %} -
  • {{ specialization }}
  • - {% endfor %} -
-
-
- {% endif %} - {% if org.parent_org %} -
-

{% translate 'Übergeordnete Organisation' %}

-

- - - {{ org.parent_org }} - -

-
- {% endif %} -
-
+ {% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %}
- {% include "fellchensammlung/partials/partial-rescue-organization-contact.html" %} + {% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
diff --git a/src/fellchensammlung/templates/fellchensammlung/forms/form-exclude-org-from-check.html b/src/fellchensammlung/templates/fellchensammlung/forms/form-exclude-org-from-check.html index 8318104..a7d555a 100644 --- a/src/fellchensammlung/templates/fellchensammlung/forms/form-exclude-org-from-check.html +++ b/src/fellchensammlung/templates/fellchensammlung/forms/form-exclude-org-from-check.html @@ -1,18 +1,35 @@ {% extends "fellchensammlung/base.html" %} {% load i18n %} {% load widget_tweaks %} +{% load admin_urls %} {% block title %} - Organisation {{ rescue_org }} von regelmäßiger Prüfung ausschließen + Organisation {{ org }} von regelmäßiger Prüfung ausschließen {% endblock %} {% block content %} -

Organisation {{ rescue_org }} von regelmäßiger Prüfung ausschließen

-
- {% csrf_token %} - {{ form }} +

Organisation {{ org }} von regelmäßiger Prüfung ausschließen

+
+
+ {% include "fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html" %} +
+
+ {% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %} +
+
+
+ {% endblock %} \ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/lists/list-animal-shelters.html b/src/fellchensammlung/templates/fellchensammlung/lists/list-animal-shelters.html index 29d5454..b4a343d 100644 --- a/src/fellchensammlung/templates/fellchensammlung/lists/list-animal-shelters.html +++ b/src/fellchensammlung/templates/fellchensammlung/lists/list-animal-shelters.html @@ -3,7 +3,7 @@ {% if rescue_organizations %} {% for rescue_organization in rescue_organizations %}
- {% include "fellchensammlung/partials/partial-rescue-organization.html" %} + {% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization.html" %}
{% endfor %} {% else %} diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html b/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html new file mode 100644 index 0000000..41e9b48 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-basic-info-card.html @@ -0,0 +1,46 @@ +{% load i18n %} +{% load custom_tags %} +
+
+

{{ org.name }}

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

{{ org.description | render_markdown }}

+
+ {% endif %} +
+ {% if org.specializations %} +
+

{% translate 'Spezialisierung' %}

+
+
    + {% for specialization in org.specializations.all %} +
  • {{ specialization }}
  • + {% endfor %} +
+
+
+ {% endif %} + {% if org.parent_org %} +
+

{% translate 'Übergeordnete Organisation' %}

+

+ + + {{ org.parent_org }} + +

+
+ {% endif %} +
+
\ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-check-rescue-org.html b/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html similarity index 100% rename from src/fellchensammlung/templates/fellchensammlung/partials/partial-check-rescue-org.html rename to src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-rescue-organization-contact.html b/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html similarity index 100% rename from src/fellchensammlung/templates/fellchensammlung/partials/partial-rescue-organization-contact.html rename to src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-rescue-organization-minimal-map.html b/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-rescue-organization-minimal-map.html similarity index 100% rename from src/fellchensammlung/templates/fellchensammlung/partials/partial-rescue-organization-minimal-map.html rename to src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-rescue-organization-minimal-map.html diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-rescue-organization.html similarity index 100% rename from src/fellchensammlung/templates/fellchensammlung/partials/partial-rescue-organization.html rename to src/fellchensammlung/templates/fellchensammlung/partials/rescue_orgs/partial-rescue-organization.html diff --git a/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html b/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html index b16b922..5d084dc 100644 --- a/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html +++ b/src/fellchensammlung/templates/fellchensammlung/rescue-organization-check.html @@ -38,7 +38,7 @@
{% for rescue_org in rescue_orgs_to_check %}
- {% include "fellchensammlung/partials/partial-check-rescue-org.html" %} + {% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
{% endfor %}
@@ -50,7 +50,7 @@
{% for rescue_org in rescue_orgs_with_ongoing_communication %}
- {% include "fellchensammlung/partials/partial-check-rescue-org.html" %} + {% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
{% endfor %}
@@ -62,7 +62,7 @@
{% for rescue_org in rescue_orgs_last_checked %}
- {% include "fellchensammlung/partials/partial-check-rescue-org.html" %} + {% include "fellchensammlung/partials/rescue_orgs/partial-check-rescue-org.html" %}
{% endfor %}
diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py index 0680084..014d643 100644 --- a/src/fellchensammlung/urls.py +++ b/src/fellchensammlung/urls.py @@ -49,6 +49,8 @@ urlpatterns = [ name="rescue-organization-detail"), path("tierschutzorganisationen//exkludieren", views.exclude_from_regular_check, name="rescue-organization-exclude"), + path("tierschutzorganisationen/add-exclusion-reason", views.update_exclusion_reason, + name="rescue-organization-add-exclusion-reason"), path("tierschutzorganisationen/spezialisierung/", views.specialized_rescues, name="specialized-rescue-organizations"), diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index 0ffde6f..da7e983 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -897,23 +897,38 @@ def rescue_organization_check_dq(request): return rescue_organization_check(request, context) -@user_passes_test(user_is_trust_level_or_above) -def exclude_from_regular_check(request, rescue_organization_id): +def exclude_from_regular_check(request, rescue_organization_id, source="organization-check"): rescue_org = get_object_or_404(RescueOrganization, pk=rescue_organization_id) if request.method == "POST": form = UpdateRescueOrgRegularCheckStatus(request.POST, instance=rescue_org) if form.is_valid(): form.save() - if form.cleaned_data["regular_check_status"] != RegularCheckStatusChoices.REGULAR_CHECK: - rescue_org.exclude_from_check = True - rescue_org.save() - return redirect(reverse("organization-check")) + to_be_excluded = form.cleaned_data["regular_check_status"] != RegularCheckStatusChoices.REGULAR_CHECK + rescue_org.exclude_from_check = to_be_excluded + rescue_org.save() + + return redirect(reverse(source)) else: 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) +@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) def moderation_tools_overview(request): context = None