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 09:14:36 -0500
commit9a4a9a8a49ed3e38f3038b8d6fc7c405256271f1 (patch)
treea4b97e11ea27067db0b8f2af8adffdfb683eebb9 /docs
parentd61ebc8fed212366340b1ed6f5d7722613801459 (diff)
Improved get_media_prefix template tag example.
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 da1ec04ab3..4c7d1d6031 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -2606,6 +2606,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.