diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/templates.txt | 13 |
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 ~~~~~~~~~~~~~~ |
