From f25c425d85e258b39f7760fb6d81b90c38791626 Mon Sep 17 00:00:00 2001 From: moanos Date: Wed, 30 Jul 2025 06:51:29 +0200 Subject: [PATCH] feat: add warning when someone is interested --- src/fellchensammlung/models.py | 10 +++++++ .../details/detail-adoption-notice.html | 15 +--------- .../partial-adoption-notice-status.html | 30 +++++++++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-status.html diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index c151688..458bbbf 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -496,6 +496,12 @@ class AdoptionNotice(models.Model): return False return self.adoptionnoticestatus.is_closed + @property + def is_interested(self): + if not hasattr(self, 'adoptionnoticestatus'): + return False + return self.adoptionnoticestatus.is_interested + @property def is_disabled_unchecked(self): if not hasattr(self, 'adoptionnoticestatus'): @@ -609,6 +615,10 @@ class AdoptionNoticeStatus(models.Model): def is_closed(self): return self.major_status == self.CLOSED + @property + def is_interested(self): + return self.major_status == self.ACTIVE and self.minor_status == "interested" + @property def is_disabled_unchecked(self): return self.major_status == self.DISABLED and self.minor_status == "unchecked" diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-adoption-notice.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-adoption-notice.html index a274481..9156228 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail-adoption-notice.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-adoption-notice.html @@ -26,20 +26,7 @@ {% endblock %} {% block content %} - {% if adoption_notice.is_closed %} -
-
-

{% translate 'Vermittlung deaktiviert' %}

-
-
- {% blocktranslate %} - Diese Vermittlung wurde deaktiviert. Typischerweise passiert das, wenn die Tiere erfolgreich - vermittelt wurden. - In den Kommentaren findest du ggf. mehr Informationen. - {% endblocktranslate %} -
-
- {% endif %} + {% include "fellchensammlung/partials/partial-adoption-notice-status.html" %}
diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-status.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-status.html new file mode 100644 index 0000000..bb3355e --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-status.html @@ -0,0 +1,30 @@ +{% load custom_tags %} +{% load i18n %} + +{% if adoption_notice.is_closed %} +
+
+

{% translate 'Vermittlung deaktiviert' %}

+
+
+ {% blocktranslate %} + Diese Vermittlung wurde deaktiviert. Typischerweise passiert das, wenn die Tiere erfolgreich + vermittelt wurden. + In den Kommentaren findest du ggf. mehr Informationen. + {% endblocktranslate %} +
+
+{% elif adoption_notice.is_interested %} +
+
+

{% translate 'Tiere sind reserviert' %}

+
+
+ {% blocktranslate %} + Diese Tiere sind bereits reserviert. + In den Kommentaren findest du ggf. mehr Informationen. + {% endblocktranslate %} +
+
+{% endif %} +