From 2190096f50c06ac4dd5754cdaa92f250e87b7b6e Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 14 Dec 2023 09:23:12 +0100 Subject: [PATCH] Used model's Options.model_name instead of object_name.lower(). Follow up to 20d487c27b40bb70496ddc7419011ca78b7d4940. --- django/contrib/admin/templatetags/base.py | 2 +- django/contrib/admin/widgets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/templatetags/base.py b/django/contrib/admin/templatetags/base.py index 23e4cfbe8683..9551c0e71df8 100644 --- a/django/contrib/admin/templatetags/base.py +++ b/django/contrib/admin/templatetags/base.py @@ -32,7 +32,7 @@ def __init__(self, parser, token, func, template_name, takes_context=True): def render(self, context): opts = context["opts"] app_label = opts.app_label.lower() - object_name = opts.object_name.lower() + object_name = opts.model_name # Load template for this render call. (Setting self.filename isn't # thread-safe.) context.render_context[self] = context.template.engine.select_template( diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index fc0cd941d12c..3352e75e79e9 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -202,7 +202,7 @@ def label_and_url_for_value(self, value): % ( self.admin_site.name, obj._meta.app_label, - obj._meta.object_name.lower(), + obj._meta.model_name, ), args=(obj.pk,), )