Skip to content
Extraits de code Groupes Projets
Valider 75e160a7 rédigé par luxcem's avatar luxcem
Parcourir les fichiers

separates current - former mandates in representatives view

parent ec32404b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</p> </p>
<h2 style="clear: both">Mandates</h2> <h2 style="clear: both">Mandates</h2>
{% for mandate in representative.mandate_set.all %} {% for mandate in representative.active_mandates %}
<div class="mandate"> <div class="mandate">
<h3> <h3>
{{ mandate.group.name }} {{ mandate.group.name }}
...@@ -33,4 +33,23 @@ ...@@ -33,4 +33,23 @@
<hr> <hr>
{% endfor %} {% endfor %}
<h2>Former mandates</h2>
{% for mandate in representative.former_mandates %}
<div class="mandate">
<h3>
{{ mandate.group.name }}
<small>
{{ mandate.role }}
</small>
</h3>
<p>
{{ mandate.begin_date }} to {{ mandate.end_date }} <br>
<strong>{{ mandate.group.kind }}</strong> : <em>{{ mandate.group.name }} ({{ mandate.group.abbreviation }})</em> <br>
Constituency : {{ mandate.constituency.name }} <br>
</p>
</div>
<hr>
{% endfor %}
{% endblock %} {% endblock %}
...@@ -10,7 +10,8 @@ def index(request): ...@@ -10,7 +10,8 @@ def index(request):
if request.GET.get('search'): if request.GET.get('search'):
search = request.GET.get('search') search = request.GET.get('search')
representative_list = Representative.objects.filter( representative_list = Representative.objects.filter(
Q(full_name__icontains=search) Q(full_name__icontains=search) |
Q(country__name__icontains=search)
) )
queries_without_page = request.GET.copy() queries_without_page = request.GET.copy()
if 'page' in queries_without_page: if 'page' in queries_without_page:
...@@ -19,7 +20,7 @@ def index(request): ...@@ -19,7 +20,7 @@ def index(request):
else: else:
representative_list = Representative.objects.all() representative_list = Representative.objects.all()
paginator = Paginator(representative_list, 5) paginator = Paginator(representative_list, 15)
page = request.GET.get('page') page = request.GET.get('page')
try: try:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter