title: Django while loop
body: <p>I wonder if there's any way to do a while loop in django (I think that's what I'm after)?</p>
  
  <p>What I'm trying to do is a nestled ul/li list.</p>
  
  <p>The list is generated by a for loop in a for loop. But since some elements in the second for loop has more child's I want to iterate or them to and so on until all child nodes are iterated out. Only way I found so far is to have another for loop. But this seems not to generic and quite repetitive. And I need to know how many "levels" of child's there are.</p>
  
  <p>This is what it look's like now:</p>
  
  <pre><code>&lt;ul&gt;
      {% for item in items %}
          &lt;li&gt;
              {{ item.name }}
              {% if item.childs %}
                  &lt;ul&gt;
                      {% for child in item.childs %}
                          &lt;li&gt;{{ child.name }}&lt;/li&gt;
                      {% endfor %}
                   &lt;/ul&gt;
              {% endif %}
          &lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Or is there a smarter way to send the data to the template?
  Can one do this with some kind of for/while loop?</p>
  
  <p>..fredrik</p>