From 60c8c28ee10de83f7894e82e08a10fccb7a1e57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 30 Mar 2021 13:51:47 -0300 Subject: [PATCH] Fixes #15 --- sigi/apps/casas/admin.py | 15 +- .../casas/convenios_inline.html} | 6 +- .../admin/casas/ocorrencia_inline.html | 164 ++++++++++++++++++ 3 files changed, 175 insertions(+), 10 deletions(-) rename sigi/apps/casas/templates/{casas/ocorrencia_inline.html => admin/casas/convenios_inline.html} (96%) create mode 100644 sigi/apps/casas/templates/admin/casas/ocorrencia_inline.html diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index 4f62949..a8c5fa8 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -90,6 +90,7 @@ class ConveniosInline(admin.TabularInline): ('data_adesao', 'data_retorno_assinatura', 'data_termo_aceite', 'data_pub_diario', 'data_devolucao_via', 'data_postagem_correio'), ('data_devolucao_sem_assinatura', 'data_retorno_sem_assinatura',), + ('get_anexos',), ('link_convenio',), )}), ) @@ -98,9 +99,10 @@ class ConveniosInline(admin.TabularInline): 'data_retorno_assinatura', 'data_termo_aceite', 'data_pub_diario', 'data_devolucao_via', 'data_postagem_correio', 'data_devolucao_sem_assinatura', - 'data_retorno_sem_assinatura',] + 'data_retorno_sem_assinatura', 'get_anexos'] extra = 0 can_delete = False + template = 'admin/casas/convenios_inline.html' def has_add_permission(self, request): return False @@ -111,11 +113,10 @@ class ConveniosInline(admin.TabularInline): # get_tramitacoes.short_description = _(u'Tramitações') # get_tramitacoes.allow_tags = True # -# def get_anexos(self, obj): -# return '
'.join(['%s' % (a.arquivo.url, a.__unicode__()) for a in obj.anexo_set.all()]) -# -# get_anexos.short_description = _(u'Anexos') -# get_anexos.allow_tags = True + def get_anexos(self, obj): + return '
'.join(['%s' % (a.arquivo.url, a.__unicode__()) for a in obj.anexo_set.all()]) + get_anexos.short_description = _(u'Anexos') + get_anexos.allow_tags = True # # def get_equipamentos(self, obj): # return '
'.join([e.__unicode__() for e in obj.equipamentoprevisto_set.all()]) @@ -229,7 +230,7 @@ class OcorrenciaInline(admin.TabularInline): extra = 0 max_num = 0 can_delete = False - template = 'casas/ocorrencia_inline.html' + template = 'admin/casas/ocorrencia_inline.html' def link_editar(self, obj): if obj.pk is None: diff --git a/sigi/apps/casas/templates/casas/ocorrencia_inline.html b/sigi/apps/casas/templates/admin/casas/convenios_inline.html similarity index 96% rename from sigi/apps/casas/templates/casas/ocorrencia_inline.html rename to sigi/apps/casas/templates/admin/casas/convenios_inline.html index 6901891..9b9a86f 100644 --- a/sigi/apps/casas/templates/casas/ocorrencia_inline.html +++ b/sigi/apps/casas/templates/admin/casas/convenios_inline.html @@ -65,9 +65,9 @@ {% endif %} {% endfor %} - - - Adicionar ocorrência + + + {% blocktrans with inline_admin_formset.opts.verbose_name|capfirst as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %} diff --git a/sigi/apps/casas/templates/admin/casas/ocorrencia_inline.html b/sigi/apps/casas/templates/admin/casas/ocorrencia_inline.html new file mode 100644 index 0000000..2103f2a --- /dev/null +++ b/sigi/apps/casas/templates/admin/casas/ocorrencia_inline.html @@ -0,0 +1,164 @@ +{% load i18n admin_static admin_modify bootstrapped_goodies_tags %} +
+ +
+ +