From 72ca3bf420eb233102128ca13e8d410371023873 Mon Sep 17 00:00:00 2001 From: cristian-longhi Date: Tue, 31 Jul 2018 11:07:38 -0300 Subject: [PATCH] =?UTF-8?q?Acerta=20agrupamento=20nos=20relat=C3=B3rios=20?= =?UTF-8?q?de=20mat=C3=A9ria=20por=20autor=20e=20em=20tramita=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/forms.py | 7 +- sapl/base/views.py | 2 +- .../RelatorioMateriasPorAutor_filter.html | 89 ++++++++++++++++++- 3 files changed, 93 insertions(+), 5 deletions(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index e60ffe072..6c1709572 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -668,6 +668,11 @@ class RelatorioMateriasTramitacaoilterSet(django_filters.FilterSet): label='Ano da Matéria', choices=RANGE_ANOS) + @property + def qs(self): + parent = super(RelatorioMateriasTramitacaoilterSet, self).qs + return parent.distinct().order_by('-ano', 'tipo', '-numero') + class Meta: model = MateriaLegislativa fields = ['ano', 'tipo', 'tramitacao__unidade_tramitacao_local', @@ -733,7 +738,7 @@ class RelatorioMateriasPorAutorFilterSet(django_filters.FilterSet): @property def qs(self): parent = super(RelatorioMateriasPorAutorFilterSet, self).qs - return parent.distinct().order_by('-ano', '-numero') + return parent.distinct().order_by('autoria__autor', '-autoria__primeiro_autor', 'tipo', '-ano', '-numero').filter(autoria__primeiro_autor='True') class Meta: model = MateriaLegislativa diff --git a/sapl/base/views.py b/sapl/base/views.py index b41492f4e..870fbbaa5 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -393,7 +393,7 @@ class RelatorioMateriasTramitacaoView(FilterView): context = super(RelatorioMateriasTramitacaoView, self).get_context_data(**kwargs) - context['title'] = _('Matérias por Ano, Autor e Tipo') + context['title'] = _('Matérias em Tramitação') qs = context['object_list'] qs = qs.filter(em_tramitacao=True) diff --git a/sapl/templates/base/RelatorioMateriasPorAutor_filter.html b/sapl/templates/base/RelatorioMateriasPorAutor_filter.html index ec26ecd63..32ebe9e1f 100644 --- a/sapl/templates/base/RelatorioMateriasPorAutor_filter.html +++ b/sapl/templates/base/RelatorioMateriasPorAutor_filter.html @@ -15,22 +15,103 @@ - + - + {% for key, value in qtdes.items %} - + {% endfor %} +{% comment %}
QUADRO GERAL
QUADRO GERAL
Tipo MatériaTipo Matéria Quantidade
{{key.sigla}} - {{key}}{{key.sigla}} - {{key}} {{value}}
+ +{% endcomment %} + + {% for materia in object_list %} + {% ifchanged materia.autoria_set.first.autor %} + + + + + + + + + + + {% endifchanged %} + + + + + + + + + {% endfor %} +
Autor: {{ materia.autoria_set.first.autor }}
MatériaEmentaCoautor(es)
+ {{materia.tipo.sigla}} {{materia.numero}}/{{materia.ano}} + {% autoescape off %}{{materia.ementa}}{% endautoescape %} + {% if materia.autoria_set.first != materia.autoria_set.last %} + {% for autor in materia.autoria_set.all %} + {% if not autor.primeiro_autor %} + {{ autor.autor }}
+ {% endif %} + {% endfor %} + {% endif %} +
+ +{% comment %} + + + + + + + + + + + + {% for materia in object_list %} + + + + + + + {% endfor %} + +
MatériaEmentaAutorCoautor(es)
+ {{materia.tipo.sigla}} {{materia.numero}}/{{materia.ano}} + {{materia.ementa}} + {% for autor in materia.autoria_set.all %} + {% if autor.primeiro_autor %} + {% ifchanged materia.autoria_set.first.autor %} + {{autor.autor}}
+ + {% endifchanged %} + {% endif %} + {% endfor %} +
+ {% for autor in materia.autoria_set.all %} + {% if not autor.primeiro_autor %} + {{autor.autor}}
+ {% endif %} + {% endfor %} +
+ + + + @@ -65,6 +146,8 @@ {% endfor %}
+{% endcomment %} + {% endif %} {% endblock base_content %}