<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Recursion in Django templates</title>
	<atom:link href="http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/</link>
	<description>Contributing back to the Google Index.</description>
	<lastBuildDate>Sat, 17 Dec 2011 12:11:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: w0manpower.com</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-2358</link>
		<dc:creator>w0manpower.com</dc:creator>
		<pubDate>Sat, 03 Sep 2011 10:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-2358</guid>
		<description>This still works like a charm years later, I also find it more elegant than doing it in the view, even though we might encounter performance issues.
It&#039;s a template that isn&#039;t used that much on the site anyway.
I have a suggestion to make the rendered code more beautiful and avoid having empty  blocks when the node has no children.
Put a if test before the include block {% include filename %} or you could also put it at the beginning of the template, so it doesn&#039;t render  with nothing inside.</description>
		<content:encoded><![CDATA[<p>This still works like a charm years later, I also find it more elegant than doing it in the view, even though we might encounter performance issues.<br />
It&#8217;s a template that isn&#8217;t used that much on the site anyway.<br />
I have a suggestion to make the rendered code more beautiful and avoid having empty  blocks when the node has no children.<br />
Put a if test before the include block {% include filename %} or you could also put it at the beginning of the template, so it doesn&#8217;t render  with nothing inside.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gevious</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-2342</link>
		<dc:creator>Gevious</dc:creator>
		<pubDate>Tue, 16 Aug 2011 12:04:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-2342</guid>
		<description>Thanks for this snippet. Works beautifully (In production too :)</description>
		<content:encoded><![CDATA[<p>Thanks for this snippet. Works beautifully (In production too <img src='http://blog.elsdoerfer.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Izkata</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-2287</link>
		<dc:creator>Izkata</dc:creator>
		<pubDate>Mon, 25 Jul 2011 16:25:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-2287</guid>
		<description>Aaaand three and a half years later, this trick still works as expected, while include with a constant still causes crashing.</description>
		<content:encoded><![CDATA[<p>Aaaand three and a half years later, this trick still works as expected, while include with a constant still causes crashing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Ash</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-1478</link>
		<dc:creator>Andrew Ash</dc:creator>
		<pubDate>Wed, 27 Oct 2010 07:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-1478</guid>
		<description>Jérémie, I&#039;m having this exact same issue while trying to get threaded-comments[1] rendering working.

Other directions I&#039;ve been going are to integrate a &quot;recursive_include&quot; into my template tags based on the function at this bug request [2].  That seemed to cause the same problems, so I&#039;m going in a new direction based on [3], which is an intricate dance between template and view to create the final template.

You wouldn&#039;t think getting threaded-comments to actually display in a nested structure would be this difficult!

Have you made progress on the issue?

[1] http://github.com/ericflo/django-threadedcomments
[2] http://code.djangoproject.com/ticket/3544
[3] http://www.elfsternberg.com/2009/05/18/template-recursion-in-django-with-treebeard/</description>
		<content:encoded><![CDATA[<p>Jérémie, I&#8217;m having this exact same issue while trying to get threaded-comments[1] rendering working.</p>
<p>Other directions I&#8217;ve been going are to integrate a &#8220;recursive_include&#8221; into my template tags based on the function at this bug request [2].  That seemed to cause the same problems, so I&#8217;m going in a new direction based on [3], which is an intricate dance between template and view to create the final template.</p>
<p>You wouldn&#8217;t think getting threaded-comments to actually display in a nested structure would be this difficult!</p>
<p>Have you made progress on the issue?</p>
<p>[1] <a href="http://github.com/ericflo/django-threadedcomments" rel="nofollow">http://github.com/ericflo/django-threadedcomments</a><br />
[2] <a href="http://code.djangoproject.com/ticket/3544" rel="nofollow">http://code.djangoproject.com/ticket/3544</a><br />
[3] <a href="http://www.elfsternberg.com/2009/05/18/template-recursion-in-django-with-treebeard/" rel="nofollow">http://www.elfsternberg.com/2009/05/18/template-recursion-in-django-with-treebeard/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jérémie</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-1318</link>
		<dc:creator>Jérémie</dc:creator>
		<pubDate>Fri, 02 Jul 2010 10:13:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-1318</guid>
		<description>Hi,

This is exactly what I need, but I can&#039;t make it work...

I put the code in a template which I included in my main template, the first include is fine, but it doesn&#039;t go further.
It react like if &quot;post&quot; from &quot;{% for post in thread %} &quot; is empty (but it&#039;s not) and doesn&#039;t go inside the loop.

Does anybody have this kind of trouble?

thanks.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>This is exactly what I need, but I can&#8217;t make it work&#8230;</p>
<p>I put the code in a template which I included in my main template, the first include is fine, but it doesn&#8217;t go further.<br />
It react like if &#8220;post&#8221; from &#8220;{% for post in thread %} &#8221; is empty (but it&#8217;s not) and doesn&#8217;t go inside the loop.</p>
<p>Does anybody have this kind of trouble?</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-1184</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Mon, 10 May 2010 21:22:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-1184</guid>
		<description>Awesome work. Was so proud of my recursion in the view and got stuck on the rendering of it in the template. Can&#039;t believe that you have to assign the filename to a variable but it works just like you said. Thanks, you&#039;re a legend!  :-)

PS! I&#039;m using it on a production system but just for admin/cms stuff, so I guess there&#039;s no real harm there. Wanted to have a menu using this (one of those nice superfish-style dropdown menus), but I suspect that that would REALLY kill the server (having to resolve this recursion on every single page call).</description>
		<content:encoded><![CDATA[<p>Awesome work. Was so proud of my recursion in the view and got stuck on the rendering of it in the template. Can&#8217;t believe that you have to assign the filename to a variable but it works just like you said. Thanks, you&#8217;re a legend!  <img src='http://blog.elsdoerfer.name/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>PS! I&#8217;m using it on a production system but just for admin/cms stuff, so I guess there&#8217;s no real harm there. Wanted to have a menu using this (one of those nice superfish-style dropdown menus), but I suspect that that would REALLY kill the server (having to resolve this recursion on every single page call).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-939</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 25 Feb 2010 21:42:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-939</guid>
		<description>I would now say it&#039;s mainly problematic since it relies on an implementation detail in the Django template language. There&#039;s no guarantee this might not stop working in a new version. 

As for performance issue, I was probably too alarmist, especially now that Django actually can cache templates in memory once compiled. So you probably shouldn&#039;t worry.

But still, if you do want to go after performance, and you are rendering out a forum thread with a huge number of branches and nodes, it&#039;ll sure be faster to set something like an indentation-level attribute in your python code.</description>
		<content:encoded><![CDATA[<p>I would now say it&#8217;s mainly problematic since it relies on an implementation detail in the Django template language. There&#8217;s no guarantee this might not stop working in a new version. </p>
<p>As for performance issue, I was probably too alarmist, especially now that Django actually can cache templates in memory once compiled. So you probably shouldn&#8217;t worry.</p>
<p>But still, if you do want to go after performance, and you are rendering out a forum thread with a huge number of branches and nodes, it&#8217;ll sure be faster to set something like an indentation-level attribute in your python code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rennat</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-938</link>
		<dc:creator>rennat</dc:creator>
		<pubDate>Thu, 25 Feb 2010 19:20:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-938</guid>
		<description>Ok so there&#039;s some cases where I really want to use this in production. (like dynamic nested nav) because it seems like an elegant solution from the way it&#039;s written.

Is this a really bad idea or just not a good idea for a million-uniques-a-day site?</description>
		<content:encoded><![CDATA[<p>Ok so there&#8217;s some cases where I really want to use this in production. (like dynamic nested nav) because it seems like an elegant solution from the way it&#8217;s written.</p>
<p>Is this a really bad idea or just not a good idea for a million-uniques-a-day site?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-579</link>
		<dc:creator>Brandon</dc:creator>
		<pubDate>Tue, 24 Mar 2009 04:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-579</guid>
		<description>How do you actually implement this in the main template? I&#039;ve tried running this code as an include, and copy/pasted into my main template and handing it a set of categories:

  
	{% for category in categories %}  
		{{ category.name }}  
		{% with &quot;list.html&quot; as filename %}  
		{% with category.category_set.all as category %}  
			{% include filename %}
		{% endwith %}  
		{% endwith %}
	{% endfor %}  
	

This causes the built-in server to completely shut down without an error. What am I doing wrong?</description>
		<content:encoded><![CDATA[<p>How do you actually implement this in the main template? I&#8217;ve tried running this code as an include, and copy/pasted into my main template and handing it a set of categories:</p>
<p>	{% for category in categories %}<br />
		{{ category.name }}<br />
		{% with &#8220;list.html&#8221; as filename %}<br />
		{% with category.category_set.all as category %}<br />
			{% include filename %}<br />
		{% endwith %}<br />
		{% endwith %}<br />
	{% endfor %}  </p>
<p>This causes the built-in server to completely shut down without an error. What am I doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://blog.elsdoerfer.name/2008/01/22/recursion-in-django-templates/comment-page-1/#comment-414</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Mon, 06 Oct 2008 20:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.elsdoerfer.info/2008/01/22/recursion-in-django-templates/#comment-414</guid>
		<description>Super cool man...
I was just wondering why recursion doesn&#039;t work... in a reply-to-a-reply rendering template of mine


Why not use in production?
What could poooooosibly ever go wrong with a recursive call :)</description>
		<content:encoded><![CDATA[<p>Super cool man&#8230;<br />
I was just wondering why recursion doesn&#8217;t work&#8230; in a reply-to-a-reply rendering template of mine</p>
<p>Why not use in production?<br />
What could poooooosibly ever go wrong with a recursive call <img src='http://blog.elsdoerfer.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

