mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.11.x] Fixed #27974 -- Kept resolved templates constant during one rendering cycle.
Thanks Florian Apolloner for the initial patch.
Backport of 002fe07622 from master
			
			
This commit is contained in:
		| @@ -212,3 +212,14 @@ class IfChangedTests(SimpleTestCase): | ||||
|         ]) | ||||
|         output = engine.render_to_string('template', dict(vars=[1, 1, 2, 2, 3, 3])) | ||||
|         self.assertEqual(output, "123") | ||||
|  | ||||
|     def test_include_state(self): | ||||
|         """Tests the node state for different IncludeNodes (#27974).""" | ||||
|         engine = Engine(loaders=[ | ||||
|             ('django.template.loaders.locmem.Loader', { | ||||
|                 'template': '{% for x in vars %}{% include "include" %}{% include "include" %}{% endfor %}', | ||||
|                 'include': '{% ifchanged %}{{ x }}{% endifchanged %}', | ||||
|             }), | ||||
|         ]) | ||||
|         output = engine.render_to_string('template', dict(vars=[1, 1, 2, 2, 3, 3])) | ||||
|         self.assertEqual(output, '112233') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user