feat: Divide adoption notices of org by active and inactive
This commit is contained in:
@@ -216,6 +216,18 @@ class RescueOrganization(models.Model):
|
|||||||
adoption_notices_discovered.extend(child.adoption_notices_in_hierarchy)
|
adoption_notices_discovered.extend(child.adoption_notices_in_hierarchy)
|
||||||
return adoption_notices_discovered
|
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
|
@property
|
||||||
def position(self):
|
def position(self):
|
||||||
if self.location:
|
if self.location:
|
||||||
|
@@ -89,13 +89,32 @@
|
|||||||
|
|
||||||
|
|
||||||
<h2 class="title is-2">{% translate 'Vermittlungen der Organisation' %}</h2>
|
<h2 class="title is-2">{% translate 'Vermittlungen der Organisation' %}</h2>
|
||||||
<div class="container-cards">
|
{% with ans_by_status=org.adoption_notices_in_hierarchy_divided_by_status %}
|
||||||
{% if org.adoption_notices_in_hierarchy %}
|
{% with active_ans=ans_by_status.0 inactive_ans=ans_by_status.1 %}
|
||||||
{% for adoption_notice in org.adoption_notices_in_hierarchy %}
|
<div class="block">
|
||||||
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
<h3 class="title is-3">{% translate 'Aktive Vermittlungen' %}</h3>
|
||||||
{% endfor %}
|
<div class="container-cards">
|
||||||
{% else %}
|
{% if active_ans %}
|
||||||
<p>{% translate "Keine Vermittlungen gefunden." %}</p>
|
{% for adoption_notice in active_ans %}
|
||||||
{% endif %}
|
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
||||||
</div>
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<p>{% translate "Keine Vermittlungen gefunden." %}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="block">
|
||||||
|
<h3 class="title is-3">{% translate 'Inaktive Vermittlungen' %}</h3>
|
||||||
|
<div class="container-cards">
|
||||||
|
{% if inactive_ans %}
|
||||||
|
{% for adoption_notice in inactive_ans %}
|
||||||
|
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<p>{% translate "Keine Vermittlungen gefunden." %}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user