From 8814f648a5038d6127246d61a4458e005df80ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Mon, 6 May 2013 15:33:51 -0300 Subject: [PATCH] =?UTF-8?q?Acrescentar=20URL=20na=20lista=20de=20servi?= =?UTF-8?q?=C3=A7os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/servicos/admin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sigi/apps/servicos/admin.py b/sigi/apps/servicos/admin.py index ccb56e7..8bb32f6 100644 --- a/sigi/apps/servicos/admin.py +++ b/sigi/apps/servicos/admin.py @@ -48,7 +48,7 @@ class TipoServicoAdmin(admin.ModelAdmin): class ServicoAdmin(admin.ModelAdmin): form = ServicoFormAdmin - list_display = ('casa_legislativa','getUf', 'tipo_servico', 'hospedagem_interlegis', 'data_ativacao', 'data_desativacao',) + list_display = ('casa_legislativa','getUf', 'tipo_servico', 'hospedagem_interlegis', 'data_ativacao', 'data_desativacao', 'getUrl') fieldsets = (( None, { 'fields': ('casa_legislativa', 'data_ativacao',) }), @@ -69,11 +69,16 @@ class ServicoAdmin(admin.ModelAdmin): inlines = (LogServicoInline,) def getUf(self, obj): - return '%s' % (obj.casa_legislativa.municipio.uf) - + return u'%s' % (obj.casa_legislativa.municipio.uf) getUf.short_description = 'UF' getUf.admin_order_field = 'casa_legislativa__municipio__uf' + def getUrl(self, obj): + return u'%s' % (obj.url, obj.url) + getUrl.short_description = 'Url' + getUrl.allow_tags = True + + def lookup_allowed(self, lookup, value): return super(ServicoAdmin, self).lookup_allowed(lookup, value) or \ lookup in ['casa_legislativa__municipio__uf__codigo_ibge__exact']