diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index f4018ab..d2b0cbd 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 | 244 | self._id = str(id(self)) |
246 | 245 | |
247 | 246 | def render(self, context): |
| 247 | if self._id not in context.render_context: |
| 248 | context.render_context[self._id] = None # last seen |
248 | 249 | if 'forloop' in context and self._id not in context['forloop']: |
249 | | self._last_seen = None |
| 250 | context.render_context[self._id] = None # last seen |
250 | 251 | context['forloop'][self._id] = 1 |
251 | 252 | try: |
252 | 253 | if self._varlist: |
… |
… |
class IfChangedNode(Node):
|
258 | 259 | except VariableDoesNotExist: |
259 | 260 | compare_to = None |
260 | 261 | |
261 | | if compare_to != self._last_seen: |
262 | | firstloop = (self._last_seen == None) |
263 | | self._last_seen = compare_to |
| 262 | if compare_to != context.render_context[self._id]: # last seen |
| 263 | firstloop = (context.render_context[self._id] == None) |
| 264 | context.render_context[self._id] = compare_to |
264 | 265 | content = self.nodelist_true.render(context) |
265 | 266 | return content |
266 | 267 | elif self.nodelist_false: |