From 1a8cbfb92d2af064f893cec37717e8598fb85bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Wed, 14 Aug 2013 12:44:59 -0300 Subject: [PATCH] =?UTF-8?q?Adicionado=20campo=20codigo=5Finterlegis=20na?= =?UTF-8?q?=20lista=20de=20servi=C3=A7os=20SEIT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/servicos/admin.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sigi/apps/servicos/admin.py b/sigi/apps/servicos/admin.py index e4e9225..74442ea 100644 --- a/sigi/apps/servicos/admin.py +++ b/sigi/apps/servicos/admin.py @@ -49,8 +49,8 @@ class TipoServicoAdmin(admin.ModelAdmin): class ServicoAdmin(admin.ModelAdmin): form = ServicoFormAdmin actions = ['calcular_data_uso',] - list_display = ('casa_legislativa','getUf', 'tipo_servico', 'hospedagem_interlegis', 'data_ativacao', 'data_desativacao', - 'getUrl', 'data_ultimo_uso', 'get_link_erro') + list_display = ('casa_legislativa', 'get_codigo_interlegis', 'get_uf', 'tipo_servico', 'hospedagem_interlegis', + 'data_ativacao', 'data_desativacao', 'getUrl', 'data_ultimo_uso', 'get_link_erro') fieldsets = (( None, { 'fields': ('casa_legislativa', 'data_ativacao',) }), @@ -69,11 +69,16 @@ class ServicoAdmin(admin.ModelAdmin): ordering = ('casa_legislativa__municipio__uf', 'casa_legislativa', 'tipo_servico',) inlines = (LogServicoInline,) search_fields = ('casa_legislativa__search_text',) + + def get_codigo_interlegis(self, obj): + return obj.casa_legislativa.codigo_interlegis + get_codigo_interlegis.short_description = u'Código Interlegis' + get_codigo_interlegis.admin_order_field = 'casa_legislativa__codigo_interlegis' - def getUf(self, obj): + def get_uf(self, obj): return u'%s' % (obj.casa_legislativa.municipio.uf) - getUf.short_description = 'UF' - getUf.admin_order_field = 'casa_legislativa__municipio__uf' + get_uf.short_description = 'UF' + get_uf.admin_order_field = 'casa_legislativa__municipio__uf' def getUrl(self, obj): return u'%s' % (obj.url, obj.url)