From 9c2beab4dde3b3b11b345d07ab853d24c8b4d13e Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Tue, 10 May 2016 11:57:47 -0300 Subject: [PATCH] Ordena listagem pela data de envio --- materia/views.py | 2 ++ parlamentares/views.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/materia/views.py b/materia/views.py index a997bb33c..aff45ef9b 100644 --- a/materia/views.py +++ b/materia/views.py @@ -80,6 +80,8 @@ class ProposicaoCrud(Crud): return 'ProposicaoCreate' class ListView(crud.base.CrudListView): + ordering = ['-data_envio', 'descricao'] + def get_rows(self, object_list): for obj in object_list: diff --git a/parlamentares/views.py b/parlamentares/views.py index 10fc9c1f9..89fd88615 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -88,8 +88,8 @@ class ParlamentarCrud(Crud): def get_rows(self, object_list): parlamentares = [] for m in object_list: - ultima_filiacao = m.parlamentar.filiacao_set.\ - order_by('-data').first() + ultima_filiacao = m.parlamentar.filiacao_set.order_by( + '-data').first() if ultima_filiacao and not ultima_filiacao.data_desfiliacao: partido = ultima_filiacao.partido.sigla else: