Commit 75e160a7 authored by luxcem's avatar luxcem

separates current - former mandates in representatives view

parent ec32404b
......@@ -16,7 +16,7 @@
</p>
<h2 style="clear: both">Mandates</h2>
{% for mandate in representative.mandate_set.all %}
{% for mandate in representative.active_mandates %}
<div class="mandate">
<h3>
{{ mandate.group.name }}
......@@ -33,4 +33,23 @@
<hr>
{% 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 %}
......@@ -10,7 +10,8 @@ def index(request):
if request.GET.get('search'):
search = request.GET.get('search')
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()
if 'page' in queries_without_page:
......@@ -19,7 +20,7 @@ def index(request):
else:
representative_list = Representative.objects.all()
paginator = Paginator(representative_list, 5)
paginator = Paginator(representative_list, 15)
page = request.GET.get('page')
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment