Commit eeb3b220 authored by njoyard's avatar njoyard
Browse files

Merge pull request #77 from political-memory/feature-enhance-dossiers

Enhance dossiers views, fixes #70
parents e28cbe1c f4a50ef9
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</li> </li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Votes Dossiers
</a> </a>
</li> </li>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</li> </li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Votes Dossiers
</a> </a>
</li> </li>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</li> </li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Votes Dossiers
</a> </a>
</li> </li>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</li> </li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Votes Dossiers
</a> </a>
</li> </li>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</li> </li>
<li> <li>
<a href='/votes/dossier/'> <a href='/votes/dossier/'>
Votes Dossiers
</a> </a>
</li> </li>
......
# Project specific "glue" coupling of all apps # Project specific "glue" coupling of all apps
from django.db import models from django.db import models
from django.db.models import Count
from core.views import GridListMixin, PaginationMixin, CSVDownloadMixin from core.views import GridListMixin, PaginationMixin, CSVDownloadMixin
from representatives import views as representatives_views from representatives import views as representatives_views
...@@ -82,4 +83,9 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail): ...@@ -82,4 +83,9 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail):
class DossierList(PaginationMixin, representatives_votes_views.DossierList): class DossierList(PaginationMixin, representatives_votes_views.DossierList):
queryset = Dossier.objects.exclude(proposals__recommendation=None) queryset = Dossier.objects.prefetch_related(
'proposals',
'proposals__recommendation'
).annotate(
nb_recomm=Count('proposals__recommendation')
).order_by('-nb_recomm', '-reference')
...@@ -34,4 +34,4 @@ ...@@ -34,4 +34,4 @@
- trans 'Committees' - trans 'Committees'
%li %li
%a{href: "{% url 'representatives_votes:dossier-list' %}"} %a{href: "{% url 'representatives_votes:dossier-list' %}"}
- trans 'Votes' - trans 'Dossiers'
- extends "base.html" - extends "base.html"
- load i18n
- load representatives_votes_tags
- block content - block content
%h2= dossier.name %h1 {{ dossier.name }} {{ dossier.title }}
%h3= dossier.title
%p %p
<strong>{{ dossier.reference }}</strong> <strong>{{ dossier.reference }}</strong>
%h3 Votes ({{dossier.proposals.count}}) %h2
- for proposal in dossier.proposals.all - trans "Recommendations"
%h4
{{ forloop.counter }}. %table.table
{{ proposal.recommendation.title }} - %tr
{{ proposal.datetime }} - %th
{{ proposal.status }} - trans "Proposal"
%p %th
{{ proposal.title }} - trans "Title"
%small %th
{{ proposal.reference }} - trans "Recommendation"
{{ proposal.kind }} %th
{{ proposal.recommendation.description }} - trans "Status"
%p %th= "for" | position_icon
%h5 %th= "against" | position_icon
For : {{ proposal.total_for }} %th= "abstain" | position_icon
%h5
Against : {{ proposal.total_against }} - for proposal in dossier.proposals.all
%h5 %tr
Abstain : {{ proposal.total_abstain }} %td
%p = proposal.title
Participants : {{ proposal.representatives.count }} %br
%small
{{ proposal.reference }}
{{ proposal.kind }}
%td= proposal.recommendation.title
%td= proposal.recommendation.recommendation | position_icon
%td= proposal.status
%td= proposal.total_for
%td= proposal.total_against
%td= proposal.total_abstain
- extends "base.html" - extends "base.html"
- load i18n
- block content - block content
%h1 Dossiers %h1
- trans "Dossiers"
%table.table %table.table
%tr
%th
- trans "Title"
%th
- trans "Recommendations"
%th
- trans "Reference"
- for dossier in object_list - for dossier in object_list
%tr %tr
%td %td
%a{'href': "{{ dossier.get_absolute_url }}"} %a{'href': "{{ dossier.get_absolute_url }}"}
{{ dossier.title }} {{ dossier.title }}
%td= dossier.nb_recomm
%td= dossier.reference %td= dossier.reference
- include "core/blocks/pagination.html" - include "core/blocks/pagination.html"
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