summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@oscaro.com>2015-03-05 09:13:56 -0500
committerTim Graham <timograham@gmail.com>2015-03-05 10:00:11 -0500
commit5de18e50dcfaec06f7fb25e62bef914f9d157938 (patch)
treee59e95839080ed8e26f7cc3d587cba1c54958cca /docs
parent1c0f66f371a3786d0e90950faf66aa9e462b2aef (diff)
[1.7.x] Improved get_media_prefix template tag example.
Backport of 9a4a9a8a49ed3e38f3038b8d6fc7c405256271f1 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/templates/builtins.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index a68b302366..823e958f3a 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -2608,6 +2608,8 @@ get_media_prefix
Similar to the :ttag:`get_static_prefix`, ``get_media_prefix`` populates a
template variable with the media prefix :setting:`MEDIA_URL`, e.g.::
- <script type="text/javascript" charset="utf-8">
- var media_path = '{% get_media_prefix %}';
- </script>
+ {% load static %}
+ <body data-media-url="{% get_media_prefix %}">
+
+By storing the value in a data attribute, we ensure it's escaped appropriately
+if we want to use it in a JavaScript context.