Skip to content
GitLab
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
33c28b26
Commit
33c28b26
authored
Mar 16, 2015
by
Mindiell
Browse files
Added a 'committee' view and modified MEP view
parent
05ab274e
Changes
3
Hide whitespace changes
Inline
Side-by-side
memopol_representatives/templates/memopol_representatives/view.html
View file @
33c28b26
...
...
@@ -10,27 +10,20 @@
<h1>
{{ representative.full_name }}
</h1>
<p>
{{ representative.country.name }} {{ representative.gender }}
<br>
Born in {{ representative.birth_place }} the {{ representative.birth_date }}
<br>
</p>
{% for mandate in representative.mandate_set.all %}
{% if mandate.group.kind == "group" %}
<h3>
{{ mandate.role }} of {{ mandate.group.name }}
</h3>
{% endif %}
{% endfor %}
<p>
Born in {{ representative.birth_place }} the {{ representative.birth_date }} ({{ representative.get_gender_display }})
</p>
<p>
{{ representative.country.name }}
</p>
<h2
style=
"clear: both"
>
Mandat
es
</h2>
<h2
style=
"clear: both"
>
Committe
es
</h2>
{% for mandate in representative.mandate_set.all %}
<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>
{% if mandate.group.kind == "committee" %}
<p>
{{ mandate.role }} of {{ mandate.group.name }} ({{ mandate.group.abbreviation }})
{% endif %}
{% endfor %}
{% endblock %}
memopol_representatives/urls.py
View file @
33c28b26
...
...
@@ -5,5 +5,6 @@ from memopol_representatives import views
urlpatterns
=
patterns
(
''
,
url
(
r
'^$'
,
views
.
index
,
name
=
'index'
),
url
(
r
'^committee/(?P<committee>\w{4})$'
,
views
.
committee
,
name
=
'committee'
),
url
(
r
'^view/(?P<num>\d+)$'
,
views
.
view
,
name
=
'view'
),
)
memopol_representatives/views.py
View file @
33c28b26
...
...
@@ -19,7 +19,45 @@ def index(request):
else
:
representative_list
=
Representative
.
objects
.
all
()
paginator
=
Paginator
(
representative_list
,
5
)
paginator
=
Paginator
(
representative_list
,
50
)
page
=
request
.
GET
.
get
(
'page'
)
try
:
representatives
=
paginator
.
page
(
page
)
except
PageNotAnInteger
:
representatives
=
paginator
.
page
(
1
)
except
EmptyPage
:
representatives
=
paginator
.
page
(
paginator
.
num_pages
)
context
[
'representatives'
]
=
representatives
return
render
(
request
,
'memopol_representatives/list.html'
,
context
)
def
committee
(
request
,
committee
):
context
=
{}
if
request
.
GET
.
get
(
'search'
):
search
=
request
.
GET
.
get
(
'search'
)
representative_list
=
Representative
.
objects
.
filter
(
mandate__group__kind
=
'committee'
,
mandate__group__abbreviation
=
committee
).
filter
(
Q
(
full_name__icontains
=
search
)
)
queries_without_page
=
request
.
GET
.
copy
()
if
'page'
in
queries_without_page
:
del
queries_without_page
[
'page'
]
context
[
'queries'
]
=
queries_without_page
else
:
representative_list
=
list
(
set
(
Representative
.
objects
.
filter
(
mandate__group__kind
=
'committee'
,
mandate__group__abbreviation
=
committee
).
all
()))
paginator
=
Paginator
(
representative_list
,
50
)
page
=
request
.
GET
.
get
(
'page'
)
try
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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