I am trying to change the link for an object in the django admin list display. Here is what I have so far:
class FooModelAdmin(admin.ModelAdmin):
fields = ('foo','bar')
list_display = ('foo_link','bar')
def foo_link(self,obj):
return u'<a href="/foos/%s/">%s</a>' % (obj.foo,obj)
domain_link.allow_tags = True
domain_link.short_description = "foo"
This produces another link within the original list display link e.g.
<a href="/admin/app/model/pk/"><a href="/foos/foo/">Foo</a></a>
allow_tags
didn't work for me, but applyingmark_safe
on the html before returning. – Lyophobic