From 62fb8d013c36ae63b7812a3366a9d51b7939fcaf Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Thu, 26 Aug 2021 09:36:49 -0300 Subject: [PATCH 1/3] Fix #72 --- sigi/apps/convenios/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigi/apps/convenios/admin.py b/sigi/apps/convenios/admin.py index 4a46d57..55b5841 100644 --- a/sigi/apps/convenios/admin.py +++ b/sigi/apps/convenios/admin.py @@ -73,7 +73,7 @@ class ConvenioAdmin(BaseModelAdmin): 'casa_legislativa__tipo', 'conveniada','equipada', 'casa_legislativa__municipio__uf',) #date_hierarchy = 'data_adesao' - ordering = ('casa_legislativa__tipo__sigla', 'casa_legislativa__municipio__uf', 'casa_legislativa') + ordering = ('casa_legislativa', '-data_retorno_assinatura') raw_id_fields = ('casa_legislativa',) get_queryset = queryset_ascii search_fields = ('id', 'search_text', 'casa_legislativa__sigla', From 0e6f0aff043f6ba33d09b1d0f2e4b668d1290fe5 Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Fri, 27 Aug 2021 09:17:56 -0300 Subject: [PATCH 2/3] Ordenando corretamente os Contatos --- sigi/apps/casas/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index 7f542dc..d448df0 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -76,9 +76,9 @@ class FuncionariosInline(admin.StackedInline): inlines = (TelefonesInline,) def get_queryset(self, request): - return (self.model.objects.exclude( - cargo='Presidente').exclude(desativado=True).order_by('-ult_alteracao') - .extra(select={'ult_null': 'ult_alteracao is null'}).extra(order_by=['ult_null']) + return (self.model.objects.exclude(cargo='Presidente') + .exclude(desativado=True).extra(select={'ult_null': 'ult_alteracao is null'}) + .order_by('ult_null', '-ult_alteracao') # A função extra foi usada para quando existir um registro com o campo igual a null não aparecer na frente dos mais novos ) From d634aeb55f0c407155187ccb15c5111b01b561ee Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Mon, 30 Aug 2021 09:35:34 -0300 Subject: [PATCH 3/3] =?UTF-8?q?Concluindo=20a=20ordena=C3=A7=C3=A3o=20dos?= =?UTF-8?q?=20presidentes=20por=20ult=5Falteracao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/casas/admin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index d448df0..1a925d5 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -50,6 +50,12 @@ class PresidenteInline(admin.StackedInline): extra = 1 max_num = 1 verbose_name_plural = _(u'Presidente') + def get_queryset(self, request): + return (self.model.objects.exclude(desativado=True) + .extra(select={'ult_null': 'ult_alteracao is null'}) + .order_by('ult_null', '-ult_alteracao') + # A função extra foi usada para quando existir um registro com o campo igual a null não aparecer na frente dos mais novos + ) class FuncionariosInline(admin.StackedInline):