From d634aeb55f0c407155187ccb15c5111b01b561ee Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Mon, 30 Aug 2021 09:35:34 -0300 Subject: [PATCH] =?UTF-8?q?Concluindo=20a=20ordena=C3=A7=C3=A3o=20dos=20pr?= =?UTF-8?q?esidentes=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):