mirror of
https://github.com/django/django.git
synced 2025-11-03 05:13:23 +00:00
Fixed #9701 -- Added a "safeseq" template filter.
This is like "safe", except it operates on the individual elements of a sequence, rather than treating the whole argument as a string. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
851461aa72
commit
dfddf129f0
3 changed files with 28 additions and 1 deletions
|
|
@ -1330,6 +1330,21 @@ safe
|
|||
Marks a string as not requiring further HTML escaping prior to output. When
|
||||
autoescaping is off, this filter has no effect.
|
||||
|
||||
.. templatefilter:: safeseq
|
||||
|
||||
safeseq
|
||||
~~~~~~~
|
||||
|
||||
Applies the :tfilter:`safe` filter to each element of a sequence. Useful in
|
||||
conjunction with other filters that operate on sequences, such as
|
||||
:tfilter:`join`. For example::
|
||||
|
||||
{{ some_list|safeseq|join:", " }}
|
||||
|
||||
You couldn't use the :tfilter:`safe` filter directly in this case, as it would
|
||||
first convert the variable into a string, rather than working with the
|
||||
individual elements of the sequence.
|
||||
|
||||
.. templatefilter:: slice
|
||||
|
||||
slice
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue