Browse Source

Ajusta ordenação de convênios

pull/163/head 3.0.33
Sesostris Vieira 2 years ago
parent
commit
7ca4ae1b5a
  1. 12
      sigi/apps/casas/admin.py
  2. 11
      sigi/apps/convenios/admin.py

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

11
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

Loading…
Cancel
Save