From cf546e11ac76c8dec527e39ff8ce8249a195ab42 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Sat, 7 Nov 2015 12:24:38 +0100 Subject: Fixed #21221 -- Made form Media and static template tag use staticfiles if installed. --- docs/topics/forms/media.txt | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'docs/topics/forms') diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt index a7975b4bce..180cd92995 100644 --- a/docs/topics/forms/media.txt +++ b/docs/topics/forms/media.txt @@ -203,12 +203,13 @@ Paths in asset definitions 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. +be prepended with the value of the appropriate prefix. If the +:mod:`django.contrib.staticfiles` app is installed, it will be used to serve +assets. -As part of the introduction of the -:doc:`staticfiles app ` two new settings were added -to refer to "static files" (images, CSS, JavaScript, etc.) that are needed -to render a complete web page: :setting:`STATIC_URL` and :setting:`STATIC_ROOT`. +Whether or not you use :mod:`django.contrib.staticfiles`, the +:setting:`STATIC_URL` and :setting:`STATIC_ROOT` settings are required to +render a complete web page. To find the appropriate prefix to use, Django will check if the :setting:`STATIC_URL` setting is not ``None`` and automatically fall back @@ -238,6 +239,18 @@ But if :setting:`STATIC_URL` is ``'http://static.example.com/'``:: +Or if :mod:`~django.contrib.staticfiles` is configured using the +`~django.contib.staticfiles.ManifestStaticFilesStorage`:: + + >>> w = CalendarWidget() + >>> print(w.media) + + + + +.. versionchanged:: 1.10 + + Older versions didn't serve assets using :mod:`django.contrib.staticfiles`. ``Media`` objects ----------------- -- cgit v1.3