From 2ae95faea7082a404e16510a7abf59bd3022319f Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 3 Oct 2016 09:41:01 -0300 Subject: [PATCH] =?UTF-8?q?Ajusta=20mat=C3=A9rias=20em=20tramita=C3=A7?= =?UTF-8?q?=C3=A3o=20na=20comiss=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/comissoes/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sapl/comissoes/views.py b/sapl/comissoes/views.py index 9d7208f62..edead6e02 100644 --- a/sapl/comissoes/views.py +++ b/sapl/comissoes/views.py @@ -68,10 +68,11 @@ class MateriasTramitacaoListView(ListView): def get_queryset(self): # FIXME: Otimizar consulta lista = [] - materias = MateriaLegislativa.objects.filter(tramitacao__isnull=False) + materias = MateriaLegislativa.objects.filter( + tramitacao__isnull=False).order_by('tipo', 'ano', 'numero') for materia in materias: comissao = materia.tramitacao_set.last( - ).unidade_tramitacao_local.comissao + ).unidade_tramitacao_destino.comissao if comissao: if comissao.pk == int(self.kwargs['pk']): lista.append(materia)