summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2007-12-04 21:08:29 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2007-12-04 21:08:29 +0000
commitb65fce659502ac5e211d13fbd5435e1ff6c703d2 (patch)
tree5d8b932b134517f5979fb58937818dd31b66c2d8 /docs
parent76b73ce72515678faff06b05dd585136fb0f5bf1 (diff)
Fixed #4131: added an "escapejs" filter for use in JavaScript strings, and updated the documentation on addslashes to point to the new ticket. Featuring contributions from Ned Batchelder, Jeremy Dunck, and Andy Durdin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6892 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/templates.txt b/docs/templates.txt
index e91d1b3e4c..3b38caf58b 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -1227,8 +1227,10 @@ Adds the arg to the value.
addslashes
~~~~~~~~~~
-Adds slashes. Useful for passing strings to JavaScript, for example.
+Adds slashes before quotes. Useful for escaping strings in CSV, for example.
+**New in Django development version**: for escaping data in JavaScript strings,
+use the `escapejs` filter instead.
capfirst
~~~~~~~~
@@ -1302,6 +1304,15 @@ applied to the result will only result in one round of escaping being done. So
it is safe to use this function even in auto-escaping environments. If you want
multiple escaping passes to be applied, use the ``force_escape`` filter.
+escapejs
+~~~~~~~~
+
+**New in Django development version**
+
+Escapes characters for use in JavaScript strings. This does *not* make the
+string safe for use in HTML, but does protect you from syntax errors when using
+templates to generate JavaScript/JSON.
+
filesizeformat
~~~~~~~~~~~~~~