Commit 7d05cdc8 authored by James Pic's avatar James Pic

Merge pull request #59 from njoyard/master

Multichamber fixes and tests update #MemopolMiniHackaton
parents a9a0d35b e2b5df28
......@@ -60,6 +60,27 @@
"model": "representatives.website",
"pk": 297
},
{
"fields": {
"country": null,
"name": "European Parliament",
"abbreviation": "EP"
},
"model": "representatives.chamber",
"pk": 1
},
{
"fields": {
"updated": "2015-12-27T16:03:31.046Z",
"name": "European Parliament",
"created": "2015-12-27T16:03:31.046Z",
"kind": "chamber",
"abbreviation": "EP",
"chamber": 1
},
"model": "representatives.group",
"pk": 1
},
{
"fields": {
"updated": "2015-12-27T16:03:31.046Z",
......@@ -67,7 +88,8 @@
"created": "2015-12-27T16:03:31.046Z",
"kind": "committee",
"abbreviation": "EMPL",
"fingerprint": "7f0e6d2c3342dde2c6077e127a418a19e0e891bb"
"fingerprint": "7f0e6d2c3342dde2c6077e127a418a19e0e891bb",
"chamber": 1
},
"model": "representatives.group",
"pk": 3
......@@ -79,7 +101,8 @@
"created": "2015-12-27T16:03:31.100Z",
"kind": "committee",
"abbreviation": "JURI",
"fingerprint": "bc1a051072a9f2caf7c5c7105bccd13834b4d89d"
"fingerprint": "bc1a051072a9f2caf7c5c7105bccd13834b4d89d",
"chamber": 1
},
"model": "representatives.group",
"pk": 9
......@@ -91,7 +114,8 @@
"created": "2015-12-27T16:03:31.388Z",
"kind": "committee",
"abbreviation": "CULT",
"fingerprint": "a169e2d7e6009d3c089e4de43c0f3e0fc312fca4"
"fingerprint": "a169e2d7e6009d3c089e4de43c0f3e0fc312fca4",
"chamber": 1
},
"model": "representatives.group",
"pk": 20
......@@ -103,7 +127,8 @@
"created": "2015-12-27T16:03:31.402Z",
"kind": "group",
"abbreviation": "SD",
"fingerprint": "729890eba3ce20f90808b32110871d1fe41b53b6"
"fingerprint": "729890eba3ce20f90808b32110871d1fe41b53b6",
"chamber": 1
},
"model": "representatives.group",
"pk": 21
......@@ -115,7 +140,8 @@
"created": "2015-12-27T16:03:31.510Z",
"kind": "committee",
"abbreviation": "ITRE",
"fingerprint": "17ff1a9fe036e400612c9153c1647a8258c34d63"
"fingerprint": "17ff1a9fe036e400612c9153c1647a8258c34d63",
"chamber": 1
},
"model": "representatives.group",
"pk": 23
......@@ -127,7 +153,8 @@
"created": "2015-12-27T16:03:31.521Z",
"kind": "committee",
"abbreviation": "REGI",
"fingerprint": "7a2a03e6d40e5af34f3dc6bccd8e1900e2de3abf"
"fingerprint": "7a2a03e6d40e5af34f3dc6bccd8e1900e2de3abf",
"chamber": 1
},
"model": "representatives.group",
"pk": 24
......@@ -139,7 +166,8 @@
"created": "2015-12-27T16:03:31.768Z",
"kind": "committee",
"abbreviation": "ECON",
"fingerprint": "2da973401cd76bb56b36f3a9162cda13d2f2d8f3"
"fingerprint": "2da973401cd76bb56b36f3a9162cda13d2f2d8f3",
"chamber": 1
},
"model": "representatives.group",
"pk": 30
......@@ -163,7 +191,8 @@
"created": "2015-12-27T16:03:32.489Z",
"kind": "group",
"abbreviation": "PSE",
"fingerprint": "53961127dd190ceb0568d2290e195570ed907164"
"fingerprint": "53961127dd190ceb0568d2290e195570ed907164",
"chamber": 1
},
"model": "representatives.group",
"pk": 41
......@@ -175,7 +204,8 @@
"created": "2015-12-27T16:03:33.606Z",
"kind": "committee",
"abbreviation": "ENVI",
"fingerprint": "9d81a89ff2836afbe40dc4109b085c00bf0b1fdd"
"fingerprint": "9d81a89ff2836afbe40dc4109b085c00bf0b1fdd",
"chamber": 1
},
"model": "representatives.group",
"pk": 48
......@@ -187,7 +217,8 @@
"created": "2015-12-27T16:03:34.712Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "6482a4de9bdda2ae85fb71f78de0cfd49441a0e6"
"fingerprint": "6482a4de9bdda2ae85fb71f78de0cfd49441a0e6",
"chamber": 1
},
"model": "representatives.group",
"pk": 64
......@@ -199,7 +230,8 @@
"created": "2015-12-27T16:03:34.756Z",
"kind": "group",
"abbreviation": "PSE",
"fingerprint": "bdcddf45a869f242e80961303a719a3e0f29d795"
"fingerprint": "bdcddf45a869f242e80961303a719a3e0f29d795",
"chamber": 1
},
"model": "representatives.group",
"pk": 67
......@@ -211,7 +243,8 @@
"created": "2015-12-27T16:03:36.124Z",
"kind": "committee",
"abbreviation": "FEMM",
"fingerprint": "07290c78bb6679e36a5413d2b8122ff4c1477889"
"fingerprint": "07290c78bb6679e36a5413d2b8122ff4c1477889",
"chamber": 1
},
"model": "representatives.group",
"pk": 77
......@@ -223,7 +256,8 @@
"created": "2015-12-27T16:03:36.219Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "171567aaa5ebc7bbdcf3fa3b8a293f9ade40c03a"
"fingerprint": "171567aaa5ebc7bbdcf3fa3b8a293f9ade40c03a",
"chamber": 1
},
"model": "representatives.group",
"pk": 79
......@@ -235,7 +269,8 @@
"created": "2015-12-27T16:03:37.137Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "e2ece7c8073aa5d8ed32a003ecb5989eb363fe95"
"fingerprint": "e2ece7c8073aa5d8ed32a003ecb5989eb363fe95",
"chamber": 1
},
"model": "representatives.group",
"pk": 86
......@@ -247,7 +282,8 @@
"created": "2015-12-27T16:03:40.000Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "25ea9a5e8434c4c550c2fa4d7d8b79769f5eb8c0"
"fingerprint": "25ea9a5e8434c4c550c2fa4d7d8b79769f5eb8c0",
"chamber": 1
},
"model": "representatives.group",
"pk": 97
......@@ -259,7 +295,8 @@
"created": "2015-12-27T16:03:42.041Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "ae4f709686238bb59f0e8d3f1f1362d6c6777744"
"fingerprint": "ae4f709686238bb59f0e8d3f1f1362d6c6777744",
"chamber": 1
},
"model": "representatives.group",
"pk": 101
......@@ -271,7 +308,8 @@
"created": "2015-12-27T16:03:47.768Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "fe7cabd2bfa99251e4f9bb2d700ec2a1898c312b"
"fingerprint": "fe7cabd2bfa99251e4f9bb2d700ec2a1898c312b",
"chamber": 1
},
"model": "representatives.group",
"pk": 111
......@@ -283,7 +321,8 @@
"created": "2015-12-27T16:03:58.940Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "6d1f6a5bcc43f05a7cfdee1d2bc7b0d0cc5db6dc"
"fingerprint": "6d1f6a5bcc43f05a7cfdee1d2bc7b0d0cc5db6dc",
"chamber": 1
},
"model": "representatives.group",
"pk": 121
......@@ -295,7 +334,8 @@
"created": "2015-12-27T16:04:34.387Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "920d936c976ee2b6fff4ce760dfb154d926dc2d1"
"fingerprint": "920d936c976ee2b6fff4ce760dfb154d926dc2d1",
"chamber": 1
},
"model": "representatives.group",
"pk": 141
......@@ -307,7 +347,8 @@
"created": "2015-12-27T16:04:50.770Z",
"kind": "delegation",
"abbreviation": "",
"fingerprint": "35588fd232a2f314c16242334bad5f5190b4efae"
"fingerprint": "35588fd232a2f314c16242334bad5f5190b4efae",
"chamber": 1
},
"model": "representatives.group",
"pk": 150
......@@ -1125,13 +1166,13 @@
"app_label": "representatives_positions"
},
"model": "contenttypes.contenttype",
"pk": 25
"pk": 26
},
{
"fields": {
"tag": 1,
"object_id": 1,
"content_type": 25
"content_type": 26
},
"model": "taggit.taggeditem",
"pk": 1
......@@ -1140,7 +1181,7 @@
"fields": {
"tag": 2,
"object_id": 1,
"content_type": 25
"content_type": 26
},
"model": "taggit.taggeditem",
"pk": 2
......@@ -1149,7 +1190,7 @@
"fields": {
"tag": 1,
"object_id": 3,
"content_type": 25
"content_type": 26
},
"model": "taggit.taggeditem",
"pk": 5
......@@ -1158,7 +1199,7 @@
"fields": {
"tag": 1,
"object_id": 2,
"content_type": 25
"content_type": 26
},
"model": "taggit.taggeditem",
"pk": 6
......@@ -1167,7 +1208,7 @@
"fields": {
"tag": 3,
"object_id": 2,
"content_type": 25
"content_type": 26
},
"model": "taggit.taggeditem",
"pk": 7
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
- The Political Memory of </title>
<link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.53baf9815401.css" type="text/css" />
<link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.0eebcec6fcc2.css" type="text/css" />
<script type="text/javascript" src="/static/collected/libs/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="/static/collected/libs/bootstrap/dist/js/bootstrap.js"></script>
......@@ -47,6 +47,11 @@
Countries
</a>
</li>
<li>
<a href='/legislature/groups/chamber/'>
Chambers
</a>
</li>
<li>
<a href='/legislature/groups/group/'>
Parties
......@@ -160,6 +165,9 @@
<th>
Name
</th>
<th>
Chamber
</th>
<th>
Country
</th>
......@@ -185,6 +193,12 @@
</a>
</td>
<td>
<a href='/legislature/representative/chamber/European%20Parliament/'>
European Parliament [EP]
</a>
</td>
<td>
<a href='/legislature/representative/country/France/'>
France [FR]
......@@ -192,7 +206,7 @@
</a>
</td>
<td>
<a href='/legislature/representative/group/Group%20of%20the%20Greens/European%20Free%20Alliance/'>
<a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Greens/European%20Free%20Alliance/'>
Greens/EFA
</a>
</td>
......
......@@ -35,7 +35,7 @@ class RepresentativeDetailTest(UrlGetTestMixin, TestCase):
def test_current_mandate_display(self):
expected = ''.join((
"<a href='/legislature/representative/group/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>", # noqa
"<a href='/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/'>", # noqa
"Member of Group of the Progressive Alliance of Socialists and Democrats in the European Parliament", # noqa
"</a>",
))
......
......@@ -10,6 +10,11 @@ admin.autodiscover()
urlpatterns = [
# Project-specific overrides
url(
r'^legislature/representative/(?P<group_kind>\w+)/(?P<chamber>.+)/' +
r'(?P<group>.+)/$',
views.RepresentativeList.as_view(),
),
url(
r'^legislature/representative/(?P<group_kind>\w+)/(?P<group>.+)/$',
views.RepresentativeList.as_view(),
......
......@@ -76,9 +76,10 @@ class PositionTest(TestCase):
# Trigger irrelevant queries that happen only once ie. constance before
# testing actual page queries.
self.client.get(position.get_absolute_url())
with self.assertNumQueries(3):
with self.assertNumQueries(4):
# One for position and rep and score
# One for rep mandates
# One for rep chamber
# One for position tags
response = self.client.get(position.get_absolute_url())
......
......@@ -5,7 +5,7 @@ setup(name='political-memory',
description='OpenShift App',
packages=['political_memory'],
package_dir={'political_memory': '.'},
author='James Pic, Laurent Peuch, Arnaud Fabre',
author='James Pic, Laurent Peuch, Arnaud Fabre, Nicolas Joyard',
author_email='cortex@worlddomination.be',
url='http://github.com/political-memory/political_memory/',
install_requires=[
......@@ -15,8 +15,8 @@ setup(name='political-memory',
'django-compressor>=1.6,<1.7',
'django-datetime-widget>=0.9,<1.0',
'django-filter>=0.11,<0.12',
'django-representatives-votes==0.0.13',
'django-representatives==0.0.14',
'django-representatives-votes==0.0.15',
'django-representatives==0.0.18',
'django-taggit>=0.17,<0.18',
'django>=1.8,<1.9',
'djangorestframework>=3.2.0,<3.3.0',
......
......@@ -5,6 +5,7 @@
@import 'table';
@import 'legislature';
@import 'positions';
@import 'chambers';
body {
background: #E5E5E5;
......
.chamber-icon {
display: inline-block;
width: 1.5em;
height: 1.5em;
vertical-align: bottom;
background-size: 100%;
&.chamber-icon-an {
background-image: url(../images/chamber-an.png);
}
&.chamber-icon-ep {
background-image: url(../images/chamber-ep.png);
}
&.chamber-icon-sen {
background-image: url(../images/chamber-sen.png);
}
}
......@@ -20,6 +20,9 @@
%li
%a{href: "{% url 'representatives:group-list' kind='country' %}"}
- trans 'Countries'
%li
%a{href: "{% url 'representatives:group-list' kind='chamber' %}"}
- trans 'Chambers'
%li
%a{href: "{% url 'representatives:group-list' kind='group' %}"}
- trans 'Parties'
......
......@@ -18,6 +18,11 @@
%th Score
%td
= representative.score.score|score_label
%tr
%th Chamber
%td<
%a{'href': "{% url 'representatives:representative-list' group_kind='chamber' group=representative.chamber.name %}"}
= representative.chamber|chamber_icon
%tr
%th Country
%td<
......
- extends 'base.html'
- load representatives_tags
- block content
%table.table
- for group in object_list
%tr
- if group.kind != 'country' and group.kind != 'chamber'
%td
%a{'href': "{% url 'representatives:representative-list' group_kind='chamber' group=group.chamber.name %}"}
= group.chamber|chamber_icon
%td
%a{'href': '{{ group.get_absolute_url }}'}w
%a{'href': '{{ group.get_absolute_url }}'}
- if group.abbreviation
={group.abbreviation}
%td
%a{'href': '{{ group.get_absolute_url }}'}= group.name
%a{'href': '{{ group.get_absolute_url }}'}=
- if group.kind == 'chamber'
= group|chamber_icon
- else
= group.name
......@@ -48,8 +48,12 @@
{{ mandate.group.name }}
- if mandate.group.abbreviation
{{ mandate.group.abbreviation }}
%td= mandate.begin_date|mandate_date:'d/m/Y'
%td= mandate.end_date|mandate_date:'d/m/Y'
%td
- if mandate.begin_date
= mandate.begin_date|mandate_date:'d/m/Y'
%td
- if mandate.end_date
= mandate.end_date|mandate_date:'d/m/Y'
%td= mandate.constituency.name
.positions
......
......@@ -15,6 +15,9 @@
%li.name
%a{'href': "{{ representative.get_absolute_url }}"}
= representative.full_name
%li.chamber
%a{'href': "{% url 'representatives:representative-list' group_kind='chamber' group=representative.chamber.name %}"}
= representative.chamber|chamber_icon
%li.country
%a{'href': "{{ representative.country.get_absolute_url }}"}
= representative.country|country_flag
......
......@@ -27,6 +27,8 @@
- trans 'Photo'
%th
- trans 'Name'
%th
- trans 'Chamber'
%th
- trans 'Country'
%th
......@@ -44,6 +46,10 @@
%a{'href': "{{ representative.get_absolute_url }}"}
= representative.full_name
%td
%a{'href': "{% url 'representatives:representative-list' group_kind='chamber' group=representative.chamber.name %}"}
= representative.chamber
%td
%a{'href': "{{ representative.country.get_absolute_url }}"}
= representative.country
......
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