diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index 1bace83..e222457 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -216,6 +216,18 @@ class RescueOrganization(models.Model): adoption_notices_discovered.extend(child.adoption_notices_in_hierarchy) return adoption_notices_discovered + @property + def adoption_notices_in_hierarchy_divided_by_status(self): + """Returns two lists of adoption notices, the first active, the other inactive.""" + active_adoption_notices = [] + inactive_adoption_notices = [] + for an in self.adoption_notices_in_hierarchy: + if an.is_active: + active_adoption_notices.append(an) + else: + inactive_adoption_notices.append(an) + return active_adoption_notices, inactive_adoption_notices + @property def position(self): if self.location: diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html index 0a051c2..c39b27b 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html @@ -89,13 +89,32 @@

{% translate 'Vermittlungen der Organisation' %}

-
- {% if org.adoption_notices_in_hierarchy %} - {% for adoption_notice in org.adoption_notices_in_hierarchy %} - {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %} - {% endfor %} - {% else %} -

{% translate "Keine Vermittlungen gefunden." %}

- {% endif %} -
+ {% with ans_by_status=org.adoption_notices_in_hierarchy_divided_by_status %} + {% with active_ans=ans_by_status.0 inactive_ans=ans_by_status.1 %} +
+

{% translate 'Aktive Vermittlungen' %}

+
+ {% if active_ans %} + {% for adoption_notice in active_ans %} + {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %} + {% endfor %} + {% else %} +

{% translate "Keine Vermittlungen gefunden." %}

+ {% endif %} +
+
+
+

{% translate 'Inaktive Vermittlungen' %}

+
+ {% if inactive_ans %} + {% for adoption_notice in inactive_ans %} + {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %} + {% endfor %} + {% else %} +

{% translate "Keine Vermittlungen gefunden." %}

+ {% endif %} +
+
+ {% endwith %} + {% endwith %} {% endblock %}