Fixed #3749 -- Set the context correctly when using the "filter" template tag.
Thanks, Zak Johnson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
43cd7bb110
commit
2a512a4e83
1
AUTHORS
1
AUTHORS
|
@ -113,6 +113,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Tom Insam
|
Tom Insam
|
||||||
Baurzhan Ismagulov <ibr@radix50.net>
|
Baurzhan Ismagulov <ibr@radix50.net>
|
||||||
jcrasta@gmail.com
|
jcrasta@gmail.com
|
||||||
|
Zak Johnson <zakj@nox.cx>
|
||||||
Michael Josephson <http://www.sdjournal.com/>
|
Michael Josephson <http://www.sdjournal.com/>
|
||||||
jpellerin@gmail.com
|
jpellerin@gmail.com
|
||||||
junzhang.jn@gmail.com
|
junzhang.jn@gmail.com
|
||||||
|
|
|
@ -41,7 +41,10 @@ class FilterNode(Node):
|
||||||
def render(self, context):
|
def render(self, context):
|
||||||
output = self.nodelist.render(context)
|
output = self.nodelist.render(context)
|
||||||
# apply filters
|
# apply filters
|
||||||
return self.filter_expr.resolve(Context({'var': output}))
|
context.update({'var': output})
|
||||||
|
filtered = self.filter_expr.resolve(context)
|
||||||
|
context.pop()
|
||||||
|
return filtered
|
||||||
|
|
||||||
class FirstOfNode(Node):
|
class FirstOfNode(Node):
|
||||||
def __init__(self, vars):
|
def __init__(self, vars):
|
||||||
|
|
|
@ -259,6 +259,7 @@ class Templates(unittest.TestCase):
|
||||||
'filter01': ('{% filter upper %}{% endfilter %}', {}, ''),
|
'filter01': ('{% filter upper %}{% endfilter %}', {}, ''),
|
||||||
'filter02': ('{% filter upper %}django{% endfilter %}', {}, 'DJANGO'),
|
'filter02': ('{% filter upper %}django{% endfilter %}', {}, 'DJANGO'),
|
||||||
'filter03': ('{% filter upper|lower %}django{% endfilter %}', {}, 'django'),
|
'filter03': ('{% filter upper|lower %}django{% endfilter %}', {}, 'django'),
|
||||||
|
'filter04': ('{% filter cut:remove %}djangospam{% endfilter %}', {'remove': 'spam'}, 'django'),
|
||||||
|
|
||||||
### FIRSTOF TAG ###########################################################
|
### FIRSTOF TAG ###########################################################
|
||||||
'firstof01': ('{% firstof a b c %}', {'a':0,'b':0,'c':0}, ''),
|
'firstof01': ('{% firstof a b c %}', {'a':0,'b':0,'c':0}, ''),
|
||||||
|
|
Loading…
Reference in New Issue