summaryrefslogtreecommitdiff
path: root/django/contrib/admin/helpers.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-03-04 15:47:49 +0100
committerClaude Paroz <claude@2xlibre.net>2017-03-04 18:18:21 +0100
commit8346680e1ca4a8ddc8190baf3f5f944f6418d5cf (patch)
treeed12bc1d1077a65c1b32d410bc267266f6e3e4f9 /django/contrib/admin/helpers.py
parent86de930f413e0ad902e11d78ac988e6743202ea6 (diff)
Refs #27795 -- Removed unneeded force_text calls
Thanks Tim Graham for the review.
Diffstat (limited to 'django/contrib/admin/helpers.py')
-rw-r--r--django/contrib/admin/helpers.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index b30dce95d2..6c69496d3b 100644
--- a/django/contrib/admin/helpers.py
+++ b/django/contrib/admin/helpers.py
@@ -10,7 +10,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.db.models.fields.related import ManyToManyRel
from django.forms.utils import flatatt
from django.template.defaultfilters import capfirst, linebreaksbr
-from django.utils.encoding import force_text
from django.utils.html import conditional_escape, format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext, gettext_lazy as _
@@ -135,7 +134,7 @@ class AdminField:
def label_tag(self):
classes = []
- contents = conditional_escape(force_text(self.field.label))
+ contents = conditional_escape(self.field.label)
if self.is_checkbox:
classes.append('vCheckboxLabel')
@@ -193,9 +192,7 @@ class AdminReadonlyField:
if not self.is_first:
attrs["class"] = "inline"
label = self.field['label']
- return format_html('<label{}>{}:</label>',
- flatatt(attrs),
- capfirst(force_text(label)))
+ return format_html('<label{}>{}:</label>', flatatt(attrs), capfirst(label))
def contents(self):
from django.contrib.admin.templatetags.admin_list import _boolean_icon
@@ -213,7 +210,7 @@ class AdminReadonlyField:
if hasattr(value, "__html__"):
result_repr = value
else:
- result_repr = linebreaksbr(force_text(value))
+ result_repr = linebreaksbr(value)
else:
if isinstance(f.remote_field, ManyToManyRel) and value is not None:
result_repr = ", ".join(map(str, value.all()))