diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content index 20cf6f9caba487f2f5bc914d2b13341ec14ed27a..64e881c0e18db6ff02bf3f86b24b2f2f692fd9cb 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content @@ -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.6aeeaa87703d.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.66ec921b2740.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> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content index e7de597296e9b05d54adb41e60d32b69d6ed5d45..f164f6e0a672d3295152e86a98b009602982a650 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content @@ -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.6aeeaa87703d.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.66ec921b2740.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> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content index 9acdba75952ac3aa5c79e5207097fbebdd85a212..c2af6dc35e815681906690d42410562e34c198e1 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content @@ -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.6aeeaa87703d.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.66ec921b2740.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> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content index 5f7c8f0944233325b18a0c529c1f909cdc6c5f2c..4afb6cfc838c70daaf6f9af7048bb07acc81c99d 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content @@ -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.6aeeaa87703d.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.66ec921b2740.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> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content index 02e261dd653dc15655acc6d736390085f13c4cf9..0c50c3a352427ebe773d21c385930f2ecc30dc4c 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content @@ -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.6aeeaa87703d.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.66ec921b2740.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> diff --git a/memopol/tests/test_representatives_detail.py b/memopol/tests/test_representatives_detail.py index 5f29b3c606cf525bd02d17ddcc69f77b888d9755..6e98b67905e6963fcd1f94c6081478ea7aef2d91 100644 --- a/memopol/tests/test_representatives_detail.py +++ b/memopol/tests/test_representatives_detail.py @@ -12,9 +12,13 @@ class RepresentativeDetailTest(UrlGetTestMixin, TestCase): # Ensure one-time cached queries occur before the actual test self.client.get(self.url) - with self.assertNumQueries(5): + with self.assertNumQueries(10): """ - One query for the rep details and foreign key (profile) + - One query for reverse relation on phones + - One query for reverse relation on addresses + - One query for reverse relation on emails + - Two queries for reverse relation on websites (social and other) - One query for reverse relation on votes - One query for reverse relation on mandates - One query for reverse relation positions diff --git a/templates/representatives/_representative_block.haml b/templates/representatives/_representative_block.haml index 4537dd5687bf819bb74948c26b61389da02136da..ca5797bfc955a15594563aeb1a86e3d2ca86d7de 100644 --- a/templates/representatives/_representative_block.haml +++ b/templates/representatives/_representative_block.haml @@ -57,27 +57,3 @@ %td - for site in representative.other_websites = site.url|website_link - - .row - .col-md-12 - %h2 Contact information - %table.table.table-condensed.detail-view - - for email in representative.email_set.all - %tr - %th E-mail - %td - = email.email|email_link - - - if representative.phone_set.all|length > 0 - %tr - %th Phone numbers - %td - - for phone in representative.phone_set.all - .phone {{ phone.number }} - - - for address in representative.address_set.all - %tr - %th - = address.name - %td - - include 'representatives/_address_block.html' with address=address \ No newline at end of file diff --git a/templates/representatives/_representative_contact.haml b/templates/representatives/_representative_contact.haml new file mode 100644 index 0000000000000000000000000000000000000000..4be0c1f602f33d9040eb1fe7ffbe64192faa01b1 --- /dev/null +++ b/templates/representatives/_representative_contact.haml @@ -0,0 +1,25 @@ +- load memopol_tags + +.row.representative-contact + .col-md-12 + %h2 Contact information + %table.table.table-condensed.detail-view + - for email in representative.email_set.all + %tr + %th E-mail + %td + = email.email|email_link + + - if representative.phone_set.all|length > 0 + %tr + %th Phone numbers + %td + - for phone in representative.phone_set.all + .phone {{ phone.number }} + + - for address in representative.address_set.all + %tr + %th + = address.name + %td + - include 'representatives/_address_block.html' with address=address diff --git a/templates/representatives/representative_detail.haml b/templates/representatives/representative_detail.haml index 94629ffda1bc816dceb3cb36c4007f2b58942510..2d81ac8638c36073c0aba38819746dbc8c8ee4eb 100644 --- a/templates/representatives/representative_detail.haml +++ b/templates/representatives/representative_detail.haml @@ -12,6 +12,7 @@ .row .col-md-6 - include 'representatives/_representative_block.html' with representative=representative + - include 'representatives/_representative_contact.html' with representative=representative .col-md-6 %h2#votes Votes