This file is indexed.

/usr/share/doc/python-django-mptt/html/templates.html is in python-django-mptt 0.6.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Working with trees in templates &mdash; django-mptt 0.6.0 documentation</title>
    
    <link rel="stylesheet" href="static/default.css" type="text/css" />
    <link rel="stylesheet" href="static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.6.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="static/jquery.js"></script>
    <script type="text/javascript" src="static/underscore.js"></script>
    <script type="text/javascript" src="static/doctools.js"></script>
    <link rel="top" title="django-mptt 0.6.0 documentation" href="index.html" />
    <link rel="next" title="Utilities for working with trees" href="utilities.html" />
    <link rel="prev" title="Working with trees in Django forms" href="forms.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="utilities.html" title="Utilities for working with trees"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="forms.html" title="Working with trees in Django forms"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">django-mptt 0.6.0 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="working-with-trees-in-templates">
<h1><a class="toc-backref" href="#id1">Working with trees in templates</a><a class="headerlink" href="#working-with-trees-in-templates" title="Permalink to this headline"></a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#working-with-trees-in-templates" id="id1">Working with trees in templates</a><ul>
<li><a class="reference internal" href="#getting-started" id="id2">Getting started</a></li>
<li><a class="reference internal" href="#recursive-tags" id="id3">Recursive tags</a><ul>
<li><a class="reference internal" href="#recursetree" id="id4"><tt class="docutils literal"><span class="pre">recursetree</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#iterative-tags" id="id5">Iterative tags</a><ul>
<li><a class="reference internal" href="#full-tree-for-model" id="id6"><tt class="docutils literal"><span class="pre">full_tree_for_model</span></tt></a></li>
<li><a class="reference internal" href="#drilldown-tree-for-node" id="id7"><tt class="docutils literal"><span class="pre">drilldown_tree_for_node</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#filters" id="id8">Filters</a><ul>
<li><a class="reference internal" href="#tree-info-filter" id="id9"><tt class="docutils literal"><span class="pre">tree_info</span></tt> filter</a></li>
<li><a class="reference internal" href="#tree-path" id="id10"><tt class="docutils literal"><span class="pre">tree_path</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples" id="id11">Examples</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="getting-started">
<h2><a class="toc-backref" href="#id2">Getting started</a><a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h2>
<p>Before you can use these tags/filters, you must:</p>
<blockquote>
<div><ul class="simple">
<li>add &#8220;mptt&#8221; to your <tt class="docutils literal"><span class="pre">INSTALLED_APPS</span></tt> in <tt class="docutils literal"><span class="pre">settings.py</span></tt></li>
<li>add <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">mptt_tags</span> <span class="pre">%}</span></tt> in your template.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="recursive-tags">
<h2><a class="toc-backref" href="#id3">Recursive tags</a><a class="headerlink" href="#recursive-tags" title="Permalink to this headline"></a></h2>
<p class="versionadded">
<span class="versionmodified">New in version 0.4.</span></p>
<p>For most setups, recursive tags are the easiest and most efficient way to render
trees.</p>
<div class="section" id="recursetree">
<h3><a class="toc-backref" href="#id4"><tt class="docutils literal"><span class="pre">recursetree</span></tt></a><a class="headerlink" href="#recursetree" title="Permalink to this headline"></a></h3>
<p class="versionadded">
<span class="versionmodified">New in version 0.4.</span></p>
<p>This tag renders a section of your template recursively for each node in your
tree.</p>
<p>For example:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">&quot;root&quot;</span><span class="nt">&gt;</span>
    <span class="cp">{%</span> <span class="k">recursetree</span> <span class="nv">nodes</span> <span class="cp">%}</span>
        <span class="nt">&lt;li&gt;</span>
            <span class="cp">{{</span> <span class="nv">node.name</span> <span class="cp">}}</span>
            <span class="cp">{%</span> <span class="k">if</span> <span class="k">not</span> <span class="nv">node.is_leaf_node</span> <span class="cp">%}</span>
                <span class="nt">&lt;ul</span> <span class="na">class=</span><span class="s">&quot;children&quot;</span><span class="nt">&gt;</span>
                    <span class="cp">{{</span> <span class="nv">children</span> <span class="cp">}}</span>
                <span class="nt">&lt;/ul&gt;</span>
            <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
        <span class="nt">&lt;/li&gt;</span>
    <span class="cp">{%</span> <span class="k">endrecursetree</span> <span class="cp">%}</span>
<span class="nt">&lt;/ul&gt;</span>
</pre></div>
</div>
<p>Note the special variables <tt class="docutils literal"><span class="pre">node</span></tt> and <tt class="docutils literal"><span class="pre">children</span></tt>.
These are magically inserted into your context while you&#8217;re inside the
<tt class="docutils literal"><span class="pre">recursetree</span></tt> tag.</p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">node</span></tt> is an instance of your MPTT model.</p>
<p><tt class="docutils literal"><span class="pre">children</span></tt> : This variable holds the rendered HTML for the children of
<tt class="docutils literal"><span class="pre">node</span></tt>.</p>
</div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>If you already have variables called <tt class="docutils literal"><span class="pre">node</span></tt> or <tt class="docutils literal"><span class="pre">children</span></tt> in your
template, and you need to access them inside the <tt class="docutils literal"><span class="pre">recursetree</span></tt> block,
you&#8217;ll need to alias them to some other name first:</p>
<div class="last highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">with</span> <span class="nv">node</span> <span class="k">as</span> <span class="nv">friendly_node</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">recursetree</span> <span class="nv">nodes</span> <span class="cp">%}</span>
        <span class="cp">{{</span> <span class="nv">node.name</span> <span class="cp">}}</span> is friends with <span class="cp">{{</span> <span class="nv">friendly_node.name</span> <span class="cp">}}</span>
        <span class="cp">{{</span> <span class="nv">children</span> <span class="cp">}}</span>
    <span class="cp">{%</span> <span class="k">endrecursetree</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endwith</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="iterative-tags">
<h2><a class="toc-backref" href="#id5">Iterative tags</a><a class="headerlink" href="#iterative-tags" title="Permalink to this headline"></a></h2>
<p>Why? These tags are better suited to unusually deep trees. If you expect to
have trees with depth &gt; 20, you should use these instead of the above.</p>
<div class="section" id="full-tree-for-model">
<h3><a class="toc-backref" href="#id6"><tt class="docutils literal"><span class="pre">full_tree_for_model</span></tt></a><a class="headerlink" href="#full-tree-for-model" title="Permalink to this headline"></a></h3>
<p>Populates a template variable with a <tt class="docutils literal"><span class="pre">QuerySet</span></tt> containing the full
tree for a given model.</p>
<p>Usage:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">full_tree_for_model</span> <span class="o">[</span><span class="nv">model</span><span class="o">]</span> <span class="k">as</span> <span class="o">[</span><span class="nv">varname</span><span class="o">]</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>The model is specified in <tt class="docutils literal"><span class="pre">[appname].[modelname]</span></tt> format.</p>
<p>Example:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">full_tree_for_model</span> <span class="nv">tests.Genre</span> <span class="k">as</span> <span class="nv">genres</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="drilldown-tree-for-node">
<h3><a class="toc-backref" href="#id7"><tt class="docutils literal"><span class="pre">drilldown_tree_for_node</span></tt></a><a class="headerlink" href="#drilldown-tree-for-node" title="Permalink to this headline"></a></h3>
<p>Populates a template variable with the drilldown tree for a given node,
optionally counting the number of items associated with its children.</p>
<p>A drilldown tree consists of a node&#8217;s ancestors, itself and its
immediate children. For example, a drilldown tree for a book category
&#8220;Personal Finance&#8221; might look something like:</p>
<div class="highlight-html+django"><pre>Books
   Business, Finance &amp; Law
      Personal Finance
         Budgeting (220)
         Financial Planning (670)</pre>
</div>
<p>Usage:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="o">[</span><span class="nv">node</span><span class="o">]</span> <span class="k">as</span> <span class="o">[</span><span class="nv">varname</span><span class="o">]</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Extended usage:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="o">[</span><span class="nv">node</span><span class="o">]</span> <span class="k">as</span> <span class="o">[</span><span class="nv">varname</span><span class="o">]</span> <span class="nv">count</span> <span class="o">[</span><span class="nv">foreign_key</span><span class="o">]</span> <span class="k">in</span> <span class="o">[</span><span class="nv">count_attr</span><span class="o">]</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="o">[</span><span class="nv">node</span><span class="o">]</span> <span class="k">as</span> <span class="o">[</span><span class="nv">varname</span><span class="o">]</span> <span class="nv">cumulative</span> <span class="nv">count</span> <span class="o">[</span><span class="nv">foreign_key</span><span class="o">]</span> <span class="k">in</span> <span class="o">[</span><span class="nv">count_attr</span><span class="o">]</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>The foreign key is specified in <tt class="docutils literal"><span class="pre">[appname].[modelname].[fieldname]</span></tt>
format, where <tt class="docutils literal"><span class="pre">fieldname</span></tt> is the name of a field in the specified
model which relates it to the given node&#8217;s model.</p>
<p>When this form is used, a <tt class="docutils literal"><span class="pre">count_attr</span></tt> attribute on each child of the
given node in the drilldown tree will contain a count of the number of
items associated with it through the given foreign key.</p>
<p>If cumulative is also specified, this count will be for items related to
the child node and all of its descendants.</p>
<p>Examples:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="nv">genre</span> <span class="k">as</span> <span class="nv">drilldown</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="nv">genre</span> <span class="k">as</span> <span class="nv">drilldown</span> <span class="nv">count</span> <span class="nv">tests.Game.genre</span> <span class="k">in</span> <span class="nv">game_count</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="nv">genre</span> <span class="k">as</span> <span class="nv">drilldown</span> <span class="nv">cumulative</span> <span class="nv">count</span> <span class="nv">tests.Game.genre</span> <span class="k">in</span> <span class="nv">game_count</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>See <a class="reference internal" href="#examples">Examples</a> for an example of how to render a drilldown
tree as a nested list.</p>
</div>
</div>
<div class="section" id="filters">
<h2><a class="toc-backref" href="#id8">Filters</a><a class="headerlink" href="#filters" title="Permalink to this headline"></a></h2>
<div class="section" id="tree-info-filter">
<h3><a class="toc-backref" href="#id9"><tt class="docutils literal"><span class="pre">tree_info</span></tt> filter</a><a class="headerlink" href="#tree-info-filter" title="Permalink to this headline"></a></h3>
<p>Given a list of tree items, iterates over the list, generating
two-tuples of the current tree item and a <tt class="docutils literal"><span class="pre">dict</span></tt> containing
information about the tree structure around the item, with the following
keys:</p>
<blockquote>
<div><dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">'new_level'</span></tt></dt>
<dd><tt class="docutils literal"><span class="pre">True</span></tt> if the current item is the start of a new level in
the tree, <tt class="docutils literal"><span class="pre">False</span></tt> otherwise.</dd>
<dt><tt class="docutils literal"><span class="pre">'closed_levels'</span></tt></dt>
<dd>A list of levels which end after the current item. This will
be an empty list if the next item&#8217;s level is the same as or
greater than the level of the current item.</dd>
</dl>
</div></blockquote>
<p>An optional argument can be provided to specify extra details about the
structure which should appear in the <tt class="docutils literal"><span class="pre">dict</span></tt>. This should be a
comma-separated list of feature names. The valid feature names are:</p>
<blockquote>
<div><dl class="docutils">
<dt>ancestors</dt>
<dd><p class="first">Adds a list of unicode representations of the ancestors of the
current node, in descending order (root node first, immediate
parent last), under the key <tt class="docutils literal"><span class="pre">'ancestors'</span></tt>.</p>
<p>For example: given the sample tree below, the contents of the list
which would be available under the <tt class="docutils literal"><span class="pre">'ancestors'</span></tt> key are given
on the right:</p>
<div class="last highlight-html+django"><div class="highlight"><pre>Books                    -&gt;  []
   Sci-fi                -&gt;  [u&#39;Books&#39;]
      Dystopian Futures  -&gt;  [u&#39;Books&#39;, u&#39;Sci-fi&#39;]
</pre></div>
</div>
</dd>
</dl>
</div></blockquote>
<p>Using this filter with unpacking in a <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">for</span> <span class="pre">%}</span></tt> tag, you should have
enough information about the tree structure to create a hierarchical
representation of the tree.</p>
<p>Example:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">for</span> <span class="nv">genre</span><span class="o">,</span><span class="nv">structure</span> <span class="k">in</span> <span class="nv">genres</span><span class="o">|</span><span class="nf">tree_info</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">if</span> <span class="nv">structure.new_level</span> <span class="cp">%}</span><span class="nt">&lt;ul&gt;&lt;li&gt;</span><span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span><span class="nt">&lt;/li&gt;&lt;li&gt;</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
        <span class="cp">{{</span> <span class="nv">genre.name</span> <span class="cp">}}</span>
    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">level</span> <span class="k">in</span> <span class="nv">structure.closed_levels</span> <span class="cp">%}</span><span class="nt">&lt;/li&gt;&lt;/ul&gt;</span><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
</div>
<div class="section" id="tree-path">
<h3><a class="toc-backref" href="#id10"><tt class="docutils literal"><span class="pre">tree_path</span></tt></a><a class="headerlink" href="#tree-path" title="Permalink to this headline"></a></h3>
<p>Creates a tree path represented by a list of items by joining the items
with a separator, which can be provided as an optional argument,
defaulting to <tt class="docutils literal"><span class="pre">'</span> <span class="pre">::</span> <span class="pre">'</span></tt>.</p>
<p>Each path item will be coerced to unicode, so a list of model instances
may be given if required.</p>
<p>Example:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{{</span> <span class="nv">some_list</span><span class="o">|</span><span class="nf">tree_path</span> <span class="cp">}}</span>
<span class="cp">{{</span> <span class="nv">some_node.get_ancestors</span><span class="o">|</span><span class="nf">tree_path</span><span class="s2">:&quot; &gt; &quot;</span> <span class="cp">}}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="examples">
<h2><a class="toc-backref" href="#id11">Examples</a><a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>Using <tt class="docutils literal"><span class="pre">drilldown_tree_for_node</span></tt> and <tt class="docutils literal"><span class="pre">tree_info</span></tt> together to render a
drilldown menu for a node, with cumulative counts of related items for the node&#8217;s
children:</p>
<div class="highlight-html+django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">drilldown_tree_for_node</span> <span class="nv">genre</span> <span class="k">as</span> <span class="nv">drilldown</span> <span class="nv">cumulative</span> <span class="nv">count</span> <span class="nv">tests.Game.genre</span> <span class="k">in</span> <span class="nv">game_count</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">node</span><span class="o">,</span><span class="nv">structure</span> <span class="k">in</span> <span class="nv">drilldown</span><span class="o">|</span><span class="nf">tree_info</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">if</span> <span class="nv">structure.new_level</span> <span class="cp">%}</span><span class="nt">&lt;ul&gt;&lt;li&gt;</span><span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span><span class="nt">&lt;/li&gt;&lt;li&gt;</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">ifequal</span> <span class="nv">node</span> <span class="nv">genre</span> <span class="cp">%}</span>
        <span class="nt">&lt;strong&gt;</span><span class="cp">{{</span> <span class="nv">node.name</span> <span class="cp">}}</span><span class="nt">&lt;/strong&gt;</span>
    <span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
        <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">node.get_absolute_url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span><span class="cp">{{</span> <span class="nv">node.name</span> <span class="cp">}}</span><span class="nt">&lt;/a&gt;</span>
        <span class="cp">{%</span> <span class="k">ifequal</span> <span class="nv">node.parent_id</span> <span class="nv">genre.pk</span> <span class="cp">%}</span>(<span class="cp">{{</span> <span class="nv">node.game_count</span> <span class="cp">}}</span>)<span class="cp">{%</span> <span class="k">endifequal</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">endifequal</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">level</span> <span class="k">in</span> <span class="nv">structure.closed_levels</span> <span class="cp">%}</span><span class="nt">&lt;/li&gt;&lt;/ul&gt;</span><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre></div>
</div>
<p>Using <tt class="docutils literal"><span class="pre">tree_info</span></tt> (with its optional argument) and <tt class="docutils literal"><span class="pre">tree_path</span></tt> together
to create a multiple-select, which:</p>
<ul class="simple">
<li>doesn&#8217;t contain root nodes</li>
<li>displays the full path to each node</li>
</ul>
<div class="highlight-html+django"><div class="highlight"><pre><span class="nt">&lt;select</span> <span class="na">name=</span><span class="s">&quot;classifiers&quot;</span> <span class="na">multiple=</span><span class="s">&quot;multiple&quot;</span> <span class="na">size=</span><span class="s">&quot;10&quot;</span><span class="nt">&gt;</span>
    <span class="cp">{%</span> <span class="k">for</span> <span class="nv">node</span><span class="o">,</span><span class="nv">structure</span> <span class="k">in</span> <span class="nv">classifiers</span><span class="o">|</span><span class="nf">tree_info</span><span class="s2">:&quot;ancestors&quot;</span> <span class="cp">%}</span>
        <span class="cp">{%</span> <span class="k">if</span> <span class="nv">node.is_child_node</span> <span class="cp">%}</span>
            <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">node.pk</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="nt">&gt;</span>
                <span class="cp">{{</span> <span class="nv">structure.ancestors</span><span class="o">|</span><span class="nf">tree_path</span> <span class="cp">}}</span> :: <span class="cp">{{</span> <span class="nv">node</span> <span class="cp">}}</span>
            <span class="nt">&lt;/option&gt;</span>
        <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
    <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="nt">&lt;/select&gt;</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Working with trees in templates</a><ul>
<li><a class="reference internal" href="#getting-started">Getting started</a></li>
<li><a class="reference internal" href="#recursive-tags">Recursive tags</a><ul>
<li><a class="reference internal" href="#recursetree"><tt class="docutils literal"><span class="pre">recursetree</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#iterative-tags">Iterative tags</a><ul>
<li><a class="reference internal" href="#full-tree-for-model"><tt class="docutils literal"><span class="pre">full_tree_for_model</span></tt></a></li>
<li><a class="reference internal" href="#drilldown-tree-for-node"><tt class="docutils literal"><span class="pre">drilldown_tree_for_node</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#filters">Filters</a><ul>
<li><a class="reference internal" href="#tree-info-filter"><tt class="docutils literal"><span class="pre">tree_info</span></tt> filter</a></li>
<li><a class="reference internal" href="#tree-path"><tt class="docutils literal"><span class="pre">tree_path</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="forms.html"
                        title="previous chapter">Working with trees in Django forms</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="utilities.html"
                        title="next chapter">Utilities for working with trees</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="sources/templates.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="utilities.html" title="Utilities for working with trees"
             >next</a> |</li>
        <li class="right" >
          <a href="forms.html" title="Working with trees in Django forms"
             >previous</a> |</li>
        <li><a href="index.html">django-mptt 0.6.0 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2007 - 2011, Jonathan Buchanan and others.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>