summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/admin/helpers.py2
-rw-r--r--tests/admin_views/tests.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index 0c0b3a4e34..83719f4346 100644
--- a/django/contrib/admin/helpers.py
+++ b/django/contrib/admin/helpers.py
@@ -187,7 +187,7 @@ class AdminReadonlyField:
if not self.is_first:
attrs["class"] = "inline"
label = self.field['label']
- return format_html('<label{}>{}:</label>', flatatt(attrs), capfirst(label))
+ return format_html('<label{}>{}{}</label>', flatatt(attrs), capfirst(label), self.form.label_suffix)
def contents(self):
from django.contrib.admin.templatetags.admin_list import _boolean_icon
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 0cc16509ff..3acbc3d7ed 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -4961,6 +4961,13 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
self.assertNotContains(response, "<a>evil</a>", status_code=200)
self.assertContains(response, "&lt;a&gt;evil&lt;/a&gt;", status_code=200)
+ def test_label_suffix_translated(self):
+ pizza = Pizza.objects.create(name='Americano')
+ url = reverse('admin:admin_views_pizza_change', args=(pizza.pk,))
+ with self.settings(LANGUAGE_CODE='fr'):
+ response = self.client.get(url)
+ self.assertContains(response, '<label>Toppings\u00A0:</label>', html=True)
+
@override_settings(ROOT_URLCONF='admin_views.urls')
class LimitChoicesToInAdminTest(TestCase):