Browse Source

Acrescentar URL na lista de serviços

stable/1.0
Sesostris Vieira 12 years ago
parent
commit
8814f648a5
  1. 11
      sigi/apps/servicos/admin.py

11
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'<a href="%s" target="_blank">%s</a>' % (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']

Loading…
Cancel
Save