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), ("email", EmptyFilter),
) )
ordering = ("municipio__uf__nome", "nome") ordering = ("municipio__uf__nome", "nome")
queryset = queryset_ascii
fieldsets = ( fieldsets = (
( (
None, None,
@ -437,7 +436,7 @@ class OrgaoAdmin(CartExportReportMixin, admin.ModelAdmin):
] ]
def get_queryset(self, request): 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") return queryset.prefetch_related("gerentes_interlegis", "convenio_set")
def save_related(self, request, form, formsets, change): def save_related(self, request, form, formsets, change):
@ -468,7 +467,14 @@ class OrgaoAdmin(CartExportReportMixin, admin.ModelAdmin):
def get_convenios(self, obj): def get_convenios(self, obj):
return mark_safe( return mark_safe(
"<ul>" "<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>" + "</ul>"
) )

11
sigi/apps/convenios/admin.py

@ -200,13 +200,16 @@ class ConvenioAdmin(ReturnMixin, CartExportReportMixin, admin.ModelAdmin):
"equipada", "equipada",
"casa_legislativa__municipio__uf", "casa_legislativa__municipio__uf",
) )
ordering = ("casa_legislativa", "-data_retorno_assinatura") ordering = (
"casa_legislativa__municipio__uf__sigla",
"casa_legislativa",
"-data_retorno_assinatura",
)
autocomplete_fields = ( autocomplete_fields = (
"casa_legislativa", "casa_legislativa",
"servico_gestao", "servico_gestao",
"servidor_gestao", "servidor_gestao",
) )
get_queryset = queryset_ascii
search_fields = ( search_fields = (
"id", "id",
"casa_legislativa__search_text", "casa_legislativa__search_text",
@ -219,9 +222,7 @@ class ConvenioAdmin(ReturnMixin, CartExportReportMixin, admin.ModelAdmin):
"report_convenios", "report_convenios",
] ]
def get_queryset(self, request): get_queryset = queryset_ascii
queryset = super(ConvenioAdmin, self).get_queryset(request)
return queryset
def get_uf(self, obj): def get_uf(self, obj):
return obj.casa_legislativa.municipio.uf.sigla return obj.casa_legislativa.municipio.uf.sigla

Loading…
Cancel
Save