﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14765	Unnecessary usage of NodeList in ForNode (template rendering)	anonymous	nobody	"There is some redundant rendering of nodes happening in template for loops:

In `ForNode` the rendering is done as follows:
 - A new `NodeList` is initialized
 - The nodes inside the for loop are rendered in the for loop's context and pushed to the nodelist
 - The nodelist is rendered in the context containing the for loop

The code is at http://code.djangoproject.com/browser/django/trunk/django/template/defaulttags.py, lines 146, 178 and 187.

Now, the last step seems redundant and wrong. It is redundant because every node was rendered in step 2 above, so why is it needed to render the nodelist again? If there is some reason for this, there needs to be a comment explaining why. If there is no reason for this second rendering, it would be more effective to change the nodelist to a plain list and return `u''.join(the_list)` from the `ForNode`.render(). The last step is wrong, because in step 2 if a node returns something that can be rendered, then that thing will be rendered in context outside of the for loop's in step 3."	Cleanup/optimization	closed	Template system	dev	Normal	fixed	ForNode render	Dmitry Trofimov FunkyBob	Accepted	1	0	0	0	0	0
