use mark_safe instead of allow_tags (#49189)
This commit is contained in:
parent
26db4f6600
commit
ca3d999afc
|
@ -7,6 +7,7 @@ from django.conf import settings
|
|||
from django.core.exceptions import PermissionDenied
|
||||
from django.urls import reverse, NoReverseMatch
|
||||
from django.conf.urls import url
|
||||
from django.utils.safestring import mark_safe
|
||||
try:
|
||||
import thread
|
||||
except ImportError:
|
||||
|
@ -251,9 +252,8 @@ class NotificationAdmin(admin.ModelAdmin):
|
|||
return ''
|
||||
|
||||
def _document(self, notification):
|
||||
return self.object_link(notification.document)
|
||||
return mark_safe(self.object_link(notification.document))
|
||||
_document.short_description = _('Document')
|
||||
_document.allow_tags = True
|
||||
|
||||
|
||||
class JournalAdmin(django_journal.admin.JournalAdmin):
|
||||
|
@ -268,11 +268,10 @@ class JournalAdmin(django_journal.admin.JournalAdmin):
|
|||
delegate = self.object_filter_link(objectdata) + \
|
||||
self.object_link(objectdata)
|
||||
if user and delegate:
|
||||
return delegate + _(' as ') + user
|
||||
return mark_safe(delegate + _(' as ') + user)
|
||||
elif user:
|
||||
return user
|
||||
return _('None')
|
||||
user.allow_tags = True
|
||||
return mark_safe(user)
|
||||
return mark_safe(_('None'))
|
||||
user.short_description = _('User')
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ from django.utils.timezone import now, utc
|
|||
from django.forms import ValidationError
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from django_journal import journal as django_journal
|
||||
from docbow_project.docbow.validators import validate_phone
|
||||
|
@ -261,9 +262,8 @@ class Document(Model):
|
|||
if kind and kind.name != last_kind_name:
|
||||
links[-1] = kind.name + ' : ' + links[-1]
|
||||
last_kind_name = kind.name
|
||||
return ', '.join(links)
|
||||
return mark_safe(', '.join(links))
|
||||
filename_links.short_description = _('Attached files')
|
||||
filename_links.allow_tags = True
|
||||
|
||||
def user_human_to(self):
|
||||
'''Return a sorted list of display names for user recipients.'''
|
||||
|
|
Loading…
Reference in New Issue