<?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: Template recursion in Django with Treebeard</title>
	<atom:link href="http://www.elfsternberg.com/2009/05/18/template-recursion-in-django-with-treebeard/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elfsternberg.com/2009/05/18/template-recursion-in-django-with-treebeard/</link>
	<description>Done, and gets things smart.</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:39:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Johan Bichel Lindegaard</title>
		<link>http://www.elfsternberg.com/2009/05/18/template-recursion-in-django-with-treebeard/comment-page-1/#comment-5670</link>
		<dc:creator>Johan Bichel Lindegaard</dc:creator>
		<pubDate>Fri, 20 May 2011 10:44:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.elfsternberg.com/?p=178#comment-5670</guid>
		<description>As of version 1.55 Treebeard provides classmethod get_annotated_list(parent=None) that you can use  to render it using one template like so:

def tree(request):
    annotated_list = MyModel.get_annotated_list()
    return render(request, &#039;tree.html&#039;, {&#039;annotated_list&#039;: annotated_list})

And then in tree.html:
{% for item, info in annotated_list %}
    {% if info.open %}
        
    {% else %}
        
    {% endif %}

    {{ item }}

    {% for close in info.close %}
        
    {% endfor %}
{% endfor %}

&lt;a href=&quot;https://tabo.pe/projects/django-treebeard/docs/1.61/api.html#treebeard.models.Node.get_annotated_list&quot; rel=&quot;nofollow&quot;&gt;see the treebeard documentation&lt;/a&gt;

- Johan</description>
		<content:encoded><![CDATA[<p>As of version 1.55 Treebeard provides classmethod get_annotated_list(parent=None) that you can use  to render it using one template like so:</p>
<p>def tree(request):<br />
    annotated_list = MyModel.get_annotated_list()<br />
    return render(request, &#8216;tree.html&#8217;, {&#8216;annotated_list&#8217;: annotated_list})</p>
<p>And then in tree.html:<br />
{% for item, info in annotated_list %}<br />
    {% if info.open %}</p>
<p>    {% else %}</p>
<p>    {% endif %}</p>
<p>    {{ item }}</p>
<p>    {% for close in info.close %}</p>
<p>    {% endfor %}<br />
{% endfor %}</p>
<p><a href="https://tabo.pe/projects/django-treebeard/docs/1.61/api.html#treebeard.models.Node.get_annotated_list" rel="nofollow">see the treebeard documentation</a></p>
<p>- Johan</p>
]]></content:encoded>
	</item>
</channel>
</rss>

