feat: Show all adoption notices of rescue org and children
This commit is contained in:
		@@ -193,6 +193,17 @@ class RescueOrganization(models.Model):
 | 
			
		||||
    def adoption_notices(self):
 | 
			
		||||
        return AdoptionNotice.objects.filter(organization=self)
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def adoption_notices_in_hierarchy(self, adoption_notices=None):
 | 
			
		||||
        """
 | 
			
		||||
        Shows all adoption notices of this rescue organization and all child organizations.
 | 
			
		||||
        """
 | 
			
		||||
        adoption_notices_discovered = list(self.adoption_notices)
 | 
			
		||||
        if self.child_organizations:
 | 
			
		||||
            for child in self.child_organizations:
 | 
			
		||||
                adoption_notices_discovered.extend(child.adoption_notices_in_hierarchy)
 | 
			
		||||
        return adoption_notices_discovered
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def position(self):
 | 
			
		||||
        if self.location:
 | 
			
		||||
@@ -233,6 +244,7 @@ class RescueOrganization(models.Model):
 | 
			
		||||
        self.exclude_from_check = True
 | 
			
		||||
        self.save()
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def child_organizations(self):
 | 
			
		||||
        return RescueOrganization.objects.filter(parent_org=self)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@
 | 
			
		||||
    <h2 class="title is-2">{% translate 'Vermittlungen der Organisation' %}</h2>
 | 
			
		||||
    <div class="container-cards">
 | 
			
		||||
        {% if org.adoption_notices %}
 | 
			
		||||
            {% for adoption_notice in org.adoption_notices %}
 | 
			
		||||
            {% for adoption_notice in org.adoption_notices_in_hierarchy %}
 | 
			
		||||
                {% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        {% else %}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,13 +15,24 @@
 | 
			
		||||
 | 
			
		||||
                    <div class="cell">
 | 
			
		||||
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <i class="fa-solid fa-location-dot fa-fw"></i>
 | 
			
		||||
                            {% if adoption_notice.location %}
 | 
			
		||||
                                {{ adoption_notice.location }}
 | 
			
		||||
                            {% else %}
 | 
			
		||||
                                {{ adoption_notice.location_string }}
 | 
			
		||||
                            {% endif %}</p>
 | 
			
		||||
                        {% if adoption_notice.organization %}
 | 
			
		||||
                            <div class="cell">
 | 
			
		||||
                        <span>
 | 
			
		||||
                            <i class="fa-solid fa-building fa-fw" aria-label="{% trans 'Tierschutzorganisation' %}"></i>
 | 
			
		||||
                                <a href="{{ adoption_notice.organization.get_absolute_url }}"> {{ adoption_notice.organization }}</a>
 | 
			
		||||
                        </span>
 | 
			
		||||
 | 
			
		||||
                            </div>
 | 
			
		||||
                        {% else %}
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <i class="fa-solid fa-location-dot fa-fw"></i>
 | 
			
		||||
                                {% if adoption_notice.location %}
 | 
			
		||||
                                    {{ adoption_notice.location }}
 | 
			
		||||
                                {% else %}
 | 
			
		||||
                                    {{ adoption_notice.location_string }}
 | 
			
		||||
                                {% endif %}
 | 
			
		||||
                            </p>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="cell">
 | 
			
		||||
                        {% include "fellchensammlung/partials/sex-overview.html" %}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user