Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
memopol
Commits
75e160a7
Commit
75e160a7
authored
Mar 16, 2015
by
luxcem
Browse files
separates current - former mandates in representatives view
parent
ec32404b
Changes
2
Hide whitespace changes
Inline
Side-by-side
memopol_representatives/templates/memopol_representatives/view.html
View file @
75e160a7
...
...
@@ -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 %}
memopol_representatives/views.py
View file @
75e160a7
...
...
@@ -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
,
1
5
)
page
=
request
.
GET
.
get
(
'page'
)
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment