From 1039d4cada5552775ab8ac30f999209ec20ce915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Cantu=C3=A1ria?= Date: Wed, 2 Sep 2020 12:46:46 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20ordena=C3=A7=C3=A3o=20expl=C3=ADcita?= =?UTF-8?q?=20em=20Mat=C3=A9ria=20Legislativa=20(#3253)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/api/views.py | 2 ++ sapl/materia/models.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sapl/api/views.py b/sapl/api/views.py index eb58616dc..ce269ba51 100644 --- a/sapl/api/views.py +++ b/sapl/api/views.py @@ -457,6 +457,8 @@ class _ProposicaoViewSet(): @customize(MateriaLegislativa) class _MateriaLegislativaViewSet: + class Meta: + ordering = ['-ano', 'tipo', 'numero'] @action(detail=True, methods=['GET']) def ultima_tramitacao(self, request, *args, **kwargs): diff --git a/sapl/materia/models.py b/sapl/materia/models.py index ba7626a24..d45252767 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -312,7 +312,7 @@ class MateriaLegislativa(models.Model): verbose_name = _('Matéria Legislativa') verbose_name_plural = _('Matérias Legislativas') unique_together = (("tipo", "numero", "ano"),) - ordering = ['-id'] + ordering = ['-ano', 'tipo', 'numero'] permissions = (("can_access_impressos", "Can access impressos"),) def __str__(self):