diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 0911309..3606258 100644
a
|
b
|
class IfChangedNode(Node):
|
189 | 189 | if compare_to != self._last_seen: |
190 | 190 | firstloop = (self._last_seen == None) |
191 | 191 | self._last_seen = compare_to |
192 | | context.push() |
193 | | context['ifchanged'] = {'firstloop': firstloop} |
194 | 192 | content = self.nodelist_true.render(context) |
195 | | context.pop() |
196 | 193 | return content |
197 | 194 | elif self.nodelist_false: |
198 | 195 | return self.nodelist_false.render(context) |
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index 4f7db62..5d48acf 100644
a
|
b
|
class Templates(unittest.TestCase):
|
598 | 598 | |
599 | 599 | 'ifchanged-else04': ('{% for id in ids %}{% ifchanged %}***{{ id }}*{% else %}...{% endifchanged %}{{ forloop.counter }}{% endfor %}', {'ids': [1,1,2,2,2,3,4]}, '***1*1...2***2*3...4...5***3*6***4*7'), |
600 | 600 | |
| 601 | # Should not pollute context in undocumented ways. |
| 602 | 'ifchanged-context01': ('{% for n in num %}{% ifchanged %}{{ n }}{{ ifchanged }}{% endifchanged %}{% endfor %}', {'num': (1,2,3), 'ifchanged': '.'}, '1.2.3.'), |
| 603 | |
601 | 604 | ### IFEQUAL TAG ########################################################### |
602 | 605 | 'ifequal01': ("{% ifequal a b %}yes{% endifequal %}", {"a": 1, "b": 2}, ""), |
603 | 606 | 'ifequal02': ("{% ifequal a b %}yes{% endifequal %}", {"a": 1, "b": 1}, "yes"), |