From fe92d762be83e8bee8af4a0f15f687554a926be0 Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 22 Jun 2025 17:35:36 +0200 Subject: [PATCH] feat: Add form for internal comment in dq view --- src/fellchensammlung/forms.py | 8 ++- .../partials/partial-check-rescue-org.html | 57 ++++++++++++------- .../templatetags/custom_tags.py | 5 ++ src/fellchensammlung/views.py | 19 +++++-- 4 files changed, 64 insertions(+), 25 deletions(-) diff --git a/src/fellchensammlung/forms.py b/src/fellchensammlung/forms.py index 2ee6f29..fd40827 100644 --- a/src/fellchensammlung/forms.py +++ b/src/fellchensammlung/forms.py @@ -1,7 +1,7 @@ from django import forms from .models import AdoptionNotice, Animal, Image, ReportAdoptionNotice, ReportComment, ModerationAction, User, Species, \ - Comment, SexChoicesWithAll, DistanceChoices, SpeciesSpecificURL + Comment, SexChoicesWithAll, DistanceChoices, SpeciesSpecificURL, RescueOrganization from django_registration.forms import RegistrationForm from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Layout, Fieldset, HTML, Row, Column, Field, Hidden @@ -117,6 +117,12 @@ class SpeciesURLForm(forms.ModelForm): fields = ('species', 'url') +class RescueOrgInternalComment(forms.ModelForm): + class Meta: + model = RescueOrganization + fields = ('internal_comment',) + + class ModerationActionForm(forms.ModelForm): class Meta: model = ModerationAction diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-check-rescue-org.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-check-rescue-org.html index 82800e3..3457345 100644 --- a/src/fellchensammlung/templates/fellchensammlung/partials/partial-check-rescue-org.html +++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-check-rescue-org.html @@ -10,28 +10,45 @@
-

- {% translate 'Zuletzt geprüft:' %} {{ rescue_org.last_checked_hr }} -

- {% if rescue_org.website %} - - - {{ rescue_org.website|domain }} - +
+

+ {% translate 'Zuletzt geprüft:' %} {{ rescue_org.last_checked_hr }} +

+ {% if rescue_org.website %} + + + {{ rescue_org.website|domain }} + + {% endif %} + {% for species_url in rescue_org.species_urls %} +

{{ species_url.species }}: {{ species_url.url }} +

+ {% endfor %} +
+ {% if set_internal_comment_avilable %} +
+
+ {% csrf_token %} + {{ comment_forms|dictkey:rescue_org.id }} + + + +
+
{% endif %} - {% for species_url in rescue_org.species_urls %} -

{{ species_url.species }}: {{ species_url.url }}

- {% endfor %} - {% if set_species_url_available %} +
-
- {% csrf_token %} - - - {{ species_url_form }} - -
- {% endif %} + {% if set_species_url_available %} + +
+ {% csrf_token %} + + + {{ species_url_form }} + +
+ {% endif %} +