Skip to content

Commit

Permalink
Fix displaying link in admin for django >= 2
Browse files Browse the repository at this point in the history
* "Support for the allow_tags attribute on ModelAdmin methods is removed."
  https://docs.djangoproject.com/en/2.0/releases/2.0/
  • Loading branch information
emi committed Feb 12, 2019
1 parent bb3641d commit 4f122d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions emailtemplates/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8
from django.contrib import admin
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _

from .forms import EmailTemplateAdminForm, MassEmailMessageForm, MassEmailAttachmentForm
Expand All @@ -23,9 +24,9 @@ class EmailTemplateAdmin(admin.ModelAdmin):
def show_links(self, obj):
if not obj.pk:
return ''
return u'<a href="%s" target="_blank">%s</a>' % (
return mark_safe(u'<a href="%s" target="_blank">%s</a>' % (
reverse('email_preview', kwargs={'pk': obj.pk}), _('Show email preview')
)
))

show_links.allow_tags = True
show_links.short_description = _('Actions')
Expand Down

0 comments on commit 4f122d6

Please sign in to comment.