From: Emilie Date: Wed, 15 Feb 2017 10:08:56 +0000 (+0100) Subject: [Person] : events and other objects X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b953470fe399c29e205c0584974cdcb4986af299;p=mezzo.git [Person] : events and other objects --- diff --git a/app/organization/network/views.py b/app/organization/network/views.py index 9e6ca5e6..10d5aaa5 100644 --- a/app/organization/network/views.py +++ b/app/organization/network/views.py @@ -59,7 +59,7 @@ class PersonDetailView(SlugMixin, DetailView): context["related"]["event"] = events # All other related models person_list_block_inlines = self.object.person_list_block_inlines.all() - related_instances = [] + context["related"]["other"] = [] # for each person list to which the person belongs to... for person_list_block_inline in person_list_block_inlines: related_objects = person_list_block_inline.person_list_block._meta.get_all_related_objects() @@ -76,10 +76,9 @@ class PersonDetailView(SlugMixin, DetailView): instance = getattr(related_inline, field.name) # get only article, custom page etc... if not isinstance(instance, person_list_block_inline.person_list_block.__class__) : #and not isinstance(person_list_block_inline.person_list_block.__class__): - if not instance._meta.model_name in context["related"]: - context["related"][instance._meta.model_name] = [] - context["related"][instance._meta.model_name].append(instance) + context["related"]["other"].append(instance) + context["related"]["other"].sort(key=lambda x: x.created, reverse=True) context["person_email"] = self.object.email if self.object.email else self.object.slug.replace('-', '.')+" (at) ircam.fr" return context diff --git a/app/templates/network/person_detail.html b/app/templates/network/person_detail.html index c2d6cb88..537f09ea 100644 --- a/app/templates/network/person_detail.html +++ b/app/templates/network/person_detail.html @@ -73,14 +73,9 @@ {{ event }}
{% endfor %} -

{% trans 'Related Articles' %}

- {% for article in related.article %} - {{ article }}
- {% endfor %} - -

{% trans 'Related Pages' %}

- {% for custompage in related.custompage %} - {{ custompage }}
+

{% trans 'Related Content' %}

+ {% for other in related.other %} + {{ other }}
{% endfor %} {% endblock %}