feat: Add reason why rescue org was excluded from check
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2025-10-20 10:54:23 +02:00
parent abeb14601a
commit 0352a60e28
8 changed files with 84 additions and 13 deletions

View File

@@ -57,6 +57,14 @@ class AnimalForm(forms.ModelForm):
} }
class UpdateRescueOrgRegularCheckStatus(forms.ModelForm):
template_name = "fellchensammlung/forms/form_snippets.html"
class Meta:
model = RescueOrganization
fields = ["regular_check_status"]
class ImageForm(forms.ModelForm): class ImageForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if 'in_flow' in kwargs: if 'in_flow' in kwargs:

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.1 on 2025-10-20 08:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellchensammlung', '0068_alter_adoptionnotice_adoption_notice_status_and_more'),
]
operations = [
migrations.AddField(
model_name='rescueorganization',
name='regular_check_status',
field=models.CharField(choices=[('regular_check', 'Wird regelmäßig geprüft'), ('excluded_no_online_listing', 'Exkludiert: Tiere werden nicht online gelistet'), ('excluded_other_org', 'Exkludiert: Andere Organisation wird geprüft'), ('excluded_scope', 'Exkludiert: Organisation hat nie Notfellchen-relevanten Vermittlungen'), ('excluded_other', 'Exkludiert: Anderer Grund')], default='regular_check', help_text='Organisationen können, durch ändern dieser Einstellung, von der regelmäßigen Prüfung ausgeschlossen werden.', max_length=30, verbose_name='Status der regelmäßigen Prüfung'),
),
]

View File

@@ -13,7 +13,7 @@ from notfellchen.settings import MEDIA_URL, base_url
from .tools.geo import LocationProxy, Position from .tools.geo import LocationProxy, Position
from .tools.misc import time_since_as_hr_string from .tools.misc import time_since_as_hr_string
from .tools.model_helpers import NotificationTypeChoices, AdoptionNoticeStatusChoices, AdoptionProcess, \ from .tools.model_helpers import NotificationTypeChoices, AdoptionNoticeStatusChoices, AdoptionProcess, \
AdoptionNoticeStatusChoicesDescriptions AdoptionNoticeStatusChoicesDescriptions, RegularCheckStatusChoices
from .tools.model_helpers import ndm as NotificationDisplayMapping from .tools.model_helpers import ndm as NotificationDisplayMapping
@@ -172,6 +172,12 @@ class RescueOrganization(models.Model):
exclude_from_check = models.BooleanField(default=False, verbose_name=_('Von Prüfung ausschließen'), exclude_from_check = models.BooleanField(default=False, verbose_name=_('Von Prüfung ausschließen'),
help_text=_("Organisation von der manuellen Überprüfung ausschließen, " help_text=_("Organisation von der manuellen Überprüfung ausschließen, "
"z.B. weil Tiere nicht online geführt werden")) "z.B. weil Tiere nicht online geführt werden"))
regular_check_status = models.CharField(max_length=30, choices=RegularCheckStatusChoices.choices,
default=RegularCheckStatusChoices.REGULAR_CHECK,
verbose_name=_('Status der regelmäßigen Prüfung'),
help_text=_(
"Organisationen können, durch ändern dieser Einstellung, von der "
"regelmäßigen Prüfung ausgeschlossen werden."))
ongoing_communication = models.BooleanField(default=False, verbose_name=_('In aktiver Kommunikation'), ongoing_communication = models.BooleanField(default=False, verbose_name=_('In aktiver Kommunikation'),
help_text=_( help_text=_(
"Es findet gerade Kommunikation zwischen Notfellchen und der Organisation statt.")) "Es findet gerade Kommunikation zwischen Notfellchen und der Organisation statt."))

View File

@@ -0,0 +1,18 @@
{% extends "fellchensammlung/base.html" %}
{% load i18n %}
{% load widget_tweaks %}
{% block title %}
<title>Organisation {{ rescue_org }} von regelmäßiger Prüfung ausschließen</title>
{% endblock %}
{% block content %}
<h1 class="title is-1">Organisation {{ rescue_org }} von regelmäßiger Prüfung ausschließen</h1>
<form method="post">
{% csrf_token %}
{{ form }}
<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" %}">
</form>
{% endblock %}

View File

@@ -75,15 +75,7 @@
</form> </form>
</div> </div>
<div class="card-footer-item is-danger"> <div class="card-footer-item is-danger">
<form method="post"> <a href="{% url 'rescue-organization-exclude' rescue_organization_id=rescue_org.pk %}">{% translate "Von Check exkludieren" %}</a>
{% csrf_token %}
<input type="hidden"
name="rescue_organization_id"
value="{{ rescue_org.pk }}">
<input type="hidden" name="action" value="exclude">
<button class="" type="submit">{% translate "Von Check exkludieren" %}</button>
</form>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -110,7 +110,8 @@ class AdoptionNoticeStatusChoicesDescriptions:
_ansc.AwaitingAction.WAITING_FOR_REVIEW: _( _ansc.AwaitingAction.WAITING_FOR_REVIEW: _(
"Deaktiviert bis Moderator*innen die Vermittlung prüfen können."), "Deaktiviert bis Moderator*innen die Vermittlung prüfen können."),
_ansc.AwaitingAction.NEEDS_ADDITIONAL_INFO: _("Deaktiviert bis Informationen nachgetragen werden."), _ansc.AwaitingAction.NEEDS_ADDITIONAL_INFO: _("Deaktiviert bis Informationen nachgetragen werden."),
_ansc.AwaitingAction.UNCHECKED: _("Vermittlung deaktiviert bis sie vom Team auf Aktualität geprüft wurde."), _ansc.AwaitingAction.UNCHECKED: _(
"Vermittlung deaktiviert bis sie vom Team auf Aktualität geprüft wurde."),
_ansc.Disabled.AGAINST_RULES: _("Vermittlung deaktiviert da sie gegen die Regeln verstößt."), _ansc.Disabled.AGAINST_RULES: _("Vermittlung deaktiviert da sie gegen die Regeln verstößt."),
_ansc.Disabled.OTHER: _("Vermittlung deaktiviert.") _ansc.Disabled.OTHER: _("Vermittlung deaktiviert.")
@@ -125,3 +126,11 @@ class AdoptionNoticeProcessTemplates:
_bp = "fellchensammlung/partials/adoption_process/" # Base path for ease _bp = "fellchensammlung/partials/adoption_process/" # Base path for ease
mapping = {AdoptionProcess.CONTACT_PERSON_IN_AN: f"{_bp}contact_person_in_an.html", mapping = {AdoptionProcess.CONTACT_PERSON_IN_AN: f"{_bp}contact_person_in_an.html",
} }
class RegularCheckStatusChoices(models.TextChoices):
REGULAR_CHECK = "regular_check", _("Wird regelmäßig geprüft")
EXCLUDED_NO_ONLINE_LISTING = "excluded_no_online_listing", _("Exkludiert: Tiere werden nicht online gelistet")
EXCLUDED_OTHER_ORG = "excluded_other_org", _("Exkludiert: Andere Organisation wird geprüft")
EXCLUDED_SCOPE = "excluded_scope", _("Exkludiert: Organisation hat nie Notfellchen-relevanten Vermittlungen")
EXCLUDED_OTHER = "excluded_other", _("Exkludiert: Anderer Grund")

View File

@@ -47,6 +47,8 @@ urlpatterns = [
path("tierschutzorganisationen/", views.list_rescue_organizations, name="rescue-organizations"), path("tierschutzorganisationen/", views.list_rescue_organizations, name="rescue-organizations"),
path("tierschutzorganisationen/<int:rescue_organization_id>/", views.detail_view_rescue_organization, path("tierschutzorganisationen/<int:rescue_organization_id>/", views.detail_view_rescue_organization,
name="rescue-organization-detail"), name="rescue-organization-detail"),
path("tierschutzorganisationen/<int:rescue_organization_id>/exkludieren", views.exclude_from_regular_check,
name="rescue-organization-exclude"),
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"),

View File

@@ -25,7 +25,8 @@ from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, Moderatio
Species, Log, Timestamp, TrustLevel, SexChoicesWithAll, SearchSubscription, \ Species, Log, Timestamp, TrustLevel, SexChoicesWithAll, SearchSubscription, \
ImportantLocation, SpeciesSpecificURL, NotificationTypeChoices, SocialMediaPost ImportantLocation, SpeciesSpecificURL, NotificationTypeChoices, SocialMediaPost
from .forms import AdoptionNoticeForm, ImageForm, ReportAdoptionNoticeForm, \ from .forms import AdoptionNoticeForm, ImageForm, ReportAdoptionNoticeForm, \
CommentForm, ReportCommentForm, AnimalForm, AdoptionNoticeFormAutoAnimal, SpeciesURLForm, RescueOrgInternalComment CommentForm, ReportCommentForm, AnimalForm, AdoptionNoticeFormAutoAnimal, SpeciesURLForm, RescueOrgInternalComment, \
UpdateRescueOrgRegularCheckStatus
from .models import Language, Announcement from .models import Language, Announcement
from .tools import i18n, img from .tools import i18n, img
from .tools.fedi import post_an_to_fedi from .tools.fedi import post_an_to_fedi
@@ -36,7 +37,7 @@ from .tools.admin import clean_locations, get_unchecked_adoption_notices, deacti
from .tasks import post_adoption_notice_save from .tasks import post_adoption_notice_save
from rest_framework.authtoken.models import Token from rest_framework.authtoken.models import Token
from .tools.model_helpers import AdoptionNoticeStatusChoices, AdoptionNoticeProcessTemplates from .tools.model_helpers import AdoptionNoticeStatusChoices, AdoptionNoticeProcessTemplates, RegularCheckStatusChoices
from .tools.search import AdoptionNoticeSearch, RescueOrgSearch from .tools.search import AdoptionNoticeSearch, RescueOrgSearch
@@ -896,6 +897,23 @@ 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):
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"))
else:
form = UpdateRescueOrgRegularCheckStatus(instance=rescue_org)
context = {"form": form, rescue_org: rescue_org}
return render(request, 'fellchensammlung/forms/form-exclude-org-from-check.html', context=context)
@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