Skip to content

Commit

Permalink
Add mark_safe() wrapper to related field links
Browse files Browse the repository at this point in the history
  • Loading branch information
darklow committed Oct 12, 2018
1 parent 52ecdad commit 9941211
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions suit/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin
from django.db import models
from django.utils.safestring import mark_safe
try:
from django.urls import reverse_lazy
except:
Expand Down Expand Up @@ -40,8 +41,8 @@ def getter(self, obj):
continue
obj = getattr(obj, related_name)
if obj and as_link:
obj = u'<a href="%s" class="link-with-icon">%s<i class="fa fa-caret-right"></i></a>' % \
(get_admin_url(obj, admin_prefix, current_app=self.admin_site.name), obj)
obj = mark_safe(u'<a href="%s" class="link-with-icon">%s<i class="fa fa-caret-right"></i></a>' % \
(get_admin_url(obj, admin_prefix, current_app=self.admin_site.name), obj))
return obj

getter.admin_order_field = admin_order_field or name
Expand Down

0 comments on commit 9941211

Please sign in to comment.