From 7ca4ae1b5a2235091ff1903ce038ea68ab038977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Thu, 23 Mar 2023 11:44:09 -0300 Subject: [PATCH] =?UTF-8?q?Ajusta=20ordena=C3=A7=C3=A3o=20de=20conv=C3=AAn?= =?UTF-8?q?ios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/casas/admin.py | 12 +++++++++--- sigi/apps/convenios/admin.py | 11 ++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index b3326b1..e6b4f10 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -356,7 +356,6 @@ class OrgaoAdmin(CartExportReportMixin, admin.ModelAdmin): ("email", EmptyFilter), ) ordering = ("municipio__uf__nome", "nome") - queryset = queryset_ascii fieldsets = ( ( None, @@ -437,7 +436,7 @@ class OrgaoAdmin(CartExportReportMixin, admin.ModelAdmin): ] def get_queryset(self, request): - queryset = super(OrgaoAdmin, self).get_queryset(request) + queryset = queryset_ascii(self, request) return queryset.prefetch_related("gerentes_interlegis", "convenio_set") def save_related(self, request, form, formsets, change): @@ -468,7 +467,14 @@ class OrgaoAdmin(CartExportReportMixin, admin.ModelAdmin): def get_convenios(self, obj): return mark_safe( "" ) diff --git a/sigi/apps/convenios/admin.py b/sigi/apps/convenios/admin.py index f0ea003..8b0848e 100644 --- a/sigi/apps/convenios/admin.py +++ b/sigi/apps/convenios/admin.py @@ -200,13 +200,16 @@ class ConvenioAdmin(ReturnMixin, CartExportReportMixin, admin.ModelAdmin): "equipada", "casa_legislativa__municipio__uf", ) - ordering = ("casa_legislativa", "-data_retorno_assinatura") + ordering = ( + "casa_legislativa__municipio__uf__sigla", + "casa_legislativa", + "-data_retorno_assinatura", + ) autocomplete_fields = ( "casa_legislativa", "servico_gestao", "servidor_gestao", ) - get_queryset = queryset_ascii search_fields = ( "id", "casa_legislativa__search_text", @@ -219,9 +222,7 @@ class ConvenioAdmin(ReturnMixin, CartExportReportMixin, admin.ModelAdmin): "report_convenios", ] - def get_queryset(self, request): - queryset = super(ConvenioAdmin, self).get_queryset(request) - return queryset + get_queryset = queryset_ascii def get_uf(self, obj): return obj.casa_legislativa.municipio.uf.sigla