Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How possible to show external links in Django Admin Interface?

I need to generate external links in admin interface grid column, but they shows as html code:

<a href="http://www.site.com/">site</a>

Admin interface translates my links as html-entities and they doesn't shows as right links. Is it possible to show external links there, not html code?

I think list_display_links doesn't work for this purpose.

Thank you!

like image 470
ramusus Avatar asked Oct 19 '25 17:10

ramusus


1 Answers

Just go further in http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-display

def colored_name(self):
    return '<span style="color: #%s;">%s %s</span>' % (self.color_code, self.first_name, self.last_name)
colored_name.allow_tags = True
like image 108
Andrea Di Persio Avatar answered Oct 21 '25 08:10

Andrea Di Persio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!