| 223 | |
| 224 | == !NodeLists must contain Nodes == |
| 225 | |
| 226 | Django's template rendering classes includes a !NodeList class, which is a subclass of Python's list type. Previously, a !NodeList could hold objects with a {{{render()}}} method (usually Node subclasses) or strings. |
| 227 | |
| 228 | In [5482], as part of an optimisation to improve template rendering speeds, this was changed so that every object in a !NodeList must be a !Node subclass (or have the same interface). Strings are no longer allowed. |
| 229 | |
| 230 | This change is unlikely to affect most code. However, if you have a custom template tag that uses !NodeList and does not populate it with Nodes, you should change your code to use normal lists instead. Django's own !ForNode class (for implementing "for loops" in templates) was the only internal code affected by this change. Consult the current implementation of {{{ForNode.iter_render}}} to see how the !NodeList usage has been replaced. |