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. --- docs/topics/forms/media.txt | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'docs/topics/forms') diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt index 6ca7c66fde..7e5a04e3d9 100644 --- a/docs/topics/forms/media.txt +++ b/docs/topics/forms/media.txt @@ -206,7 +206,10 @@ return values for dynamic ``media`` properties. Paths in asset definitions ========================== -Paths used to specify assets can be either relative or absolute. If a +Paths as strings +---------------- + +String paths used to specify assets can be either relative or absolute. If a path starts with ``/``, ``http://`` or ``https://``, it will be interpreted as an absolute path, and left as-is. All other paths will be prepended with the value of the appropriate prefix. If the @@ -254,6 +257,28 @@ Or if :mod:`~django.contrib.staticfiles` is configured using the +Paths as objects +---------------- + +.. versionadded:: 4.1 + +Asset paths may also be given as hashable objects implementing an +``__html__()`` method. The ``__html__()`` method is typically added using the +:func:`~django.utils.html.html_safe` decorator. The object is responsible for +outputting the complete HTML ``