diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index f4018ab..c5944a2 100644
a
|
b
|
class IfChangedNode(Node):
|
240 | 240 | |
241 | 241 | def __init__(self, nodelist_true, nodelist_false, *varlist): |
242 | 242 | self.nodelist_true, self.nodelist_false = nodelist_true, nodelist_false |
243 | | self._last_seen = None |
244 | 243 | self._varlist = varlist |
245 | | self._id = str(id(self)) |
246 | 244 | |
247 | 245 | def render(self, context): |
248 | | if 'forloop' in context and self._id not in context['forloop']: |
249 | | self._last_seen = None |
250 | | context['forloop'][self._id] = 1 |
| 246 | if self not in context.render_context: |
| 247 | context.render_context[self] = None # last seen |
| 248 | if 'forloop' in context and self not in context['forloop']: |
| 249 | context.render_context[self] = None # last seen |
| 250 | context['forloop'][self] = 1 |
251 | 251 | try: |
252 | 252 | if self._varlist: |
253 | 253 | # Consider multiple parameters. This automatically behaves |
… |
… |
class IfChangedNode(Node):
|
258 | 258 | except VariableDoesNotExist: |
259 | 259 | compare_to = None |
260 | 260 | |
261 | | if compare_to != self._last_seen: |
262 | | firstloop = (self._last_seen == None) |
263 | | self._last_seen = compare_to |
| 261 | if compare_to != context.render_context[self]: # last seen |
| 262 | firstloop = (context.render_context[self] == None) |
| 263 | context.render_context[self] = compare_to |
264 | 264 | content = self.nodelist_true.render(context) |
265 | 265 | return content |
266 | 266 | elif self.nodelist_false: |