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 @@
| QUADRO GERAL | |||
|---|---|---|---|
| QUADRO GERAL | |||
| Tipo Matéria | +Tipo Matéria | Quantidade | |
| {{key.sigla}} - {{key}} | +{{key.sigla}} - {{key}} | {{value}} | |
| Autor: {{ materia.autoria_set.first.autor }} | ||
|---|---|---|
| Matéria | +Ementa | +Coautor(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 %} + |
+
| Matéria | +Ementa | +Autor | +Coautor(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 %} + |
+