[1.8.x] Used format_html() in contrib.admin.utils for consistency.
Backport of fe42bfaaff
from master
This commit is contained in:
parent
bff446c205
commit
4fa61e0e4f
|
@ -13,8 +13,7 @@ from django.db.models.deletion import Collector
|
||||||
from django.forms.forms import pretty_name
|
from django.forms.forms import pretty_name
|
||||||
from django.utils import formats, six, timezone
|
from django.utils import formats, six, timezone
|
||||||
from django.utils.encoding import force_str, force_text, smart_text
|
from django.utils.encoding import force_str, force_text, smart_text
|
||||||
from django.utils.html import conditional_escape, format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.utils.translation import ungettext
|
from django.utils.translation import ungettext
|
||||||
|
|
||||||
|
@ -389,10 +388,7 @@ def display_for_field(value, field):
|
||||||
elif isinstance(field, models.FloatField):
|
elif isinstance(field, models.FloatField):
|
||||||
return formats.number_format(value)
|
return formats.number_format(value)
|
||||||
elif isinstance(field, models.FileField) and value:
|
elif isinstance(field, models.FileField) and value:
|
||||||
return mark_safe('<a href="%s">%s</a>' % (
|
return format_html('<a href="{}">{}</a>', value.url, value)
|
||||||
conditional_escape(value.url),
|
|
||||||
conditional_escape(value),
|
|
||||||
))
|
|
||||||
else:
|
else:
|
||||||
return smart_text(value)
|
return smart_text(value)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue