def ordered_items(self):
return self.items.order_by('id', '_title')
+ def get_countries(self):
+ countries = []
+ items = self.items.order_by('etat')
+ for item in items:
+ if not item.etat in countries and item.etat:
+ countries.append(item.etat)
+ return countries
+
+ def get_ethnic_groups(self):
+ groups = []
+ items = self.items.order_by('ethnie_grsocial')
+ for item in items:
+ if not item.ethnie_grsocial in groups and item.ethnie_grsocial:
+ groups.append(item.ethnie_grsocial)
+ return groups
+
def __str__(self):
#return self.title
return self.id
<h4 class="on"><a href="#">Données ethnographiques</a></h4>
<div>
<dl class="listing">
- <dt>État / Nation</dt><dd>{% for item in object.items.all %}{% if item.etat %}{{item.etat}}{% if not forloop.last %}, {% endif %}{% endif %}{% endfor %}</dd>
- <dt>Ethnie / Groupe social</dt><dd>{% for item in object.items.all %}{% if item.ethnie_grsocial %}{{item.ethnie_grsocial}}{% if not forloop.last %}, {% endif %}{% endif %}{% endfor %}</dd>
+ <dt>État / Nation</dt><dd>{{object.get_countries|join:", "}}</dd>
+ <dt>Ethnie / Groupe social</dt><dd>{{ object.get_ethnic_groups|join:", " }}</dd>
<dt>Contexte de l’enregistrement</dt><dd>{{ object.terrain_ou_autre }}</dd>
</dl>
</div>