From 4c76ffc2d6c77c850b4bef8d9acc197d11c47937 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 22 Jan 2022 17:21:57 +0100 Subject: Fixed #29490 -- Added support for object-based Media CSS and JS paths. --- django/forms/widgets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'django/forms/widgets.py') diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 8c5122ad1d..208464b60a 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -101,7 +101,9 @@ class Media: def render_js(self): return [ - format_html('', self.absolute_path(path)) + path.__html__() + if hasattr(path, "__html__") + else format_html('', self.absolute_path(path)) for path in self._js ] @@ -111,7 +113,9 @@ class Media: media = sorted(self._css) return chain.from_iterable( [ - format_html( + path.__html__() + if hasattr(path, "__html__") + else format_html( '', self.absolute_path(path), medium, -- cgit v1.3