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(
"
"
- + "".join([f"- {c}
" for c in obj.convenio_set.all()])
+ + "".join(
+ [
+ f"- {c}
"
+ for c in obj.convenio_set.order_by(
+ "-data_retorno_assinatura"
+ )
+ ]
+ )
+ "
"
)
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