title: Is there any better way to display ete2 Tree in Django template?
body: <p>I am building a WebApplication using <a href="http://www.djangobook.com/en/2.0/chapter01.html" rel="nofollow">Django</a> framework. At server side I am building <a href="http://packages.python.org/ete2/tutorial/tutorial_trees.html" rel="nofollow">ete2 tree</a> according to the input given by user using browser. Now my problem is I need to display this tree in client side (browser) in tree format with each node as a hyperlink (clicking on nodes displayed in tree format should invoke a function at server side passing node name as parameter, that why I mentioned it as hyperlink).</p>
  
  <p>one solution came to my mind is parse the <a href="http://packages.python.org/ete2/tutorial/tutorial_trees.html" rel="nofollow">ete2.tree</a> in <a href="http://www.djangobook.com/en/2.0/chapter03.html" rel="nofollow">views</a> function and build a string with all html tags needed which at display on browser looks like the following.</p>
  
  <pre><code>             + root
                 + child1
                     + grandson
                 + child2
  </code></pre>
  
  <p>Code to do this:
  from ete2 import Tree</p>
  
  <pre><code>def display_view(request):
        global tree
        string = tree2str(tree)
        return render_to_response('index.html', {'string': string} )
  
  def tree2strtr():
    global tree
    tmp = ''
    for node in tree.traverse():
      if node.name != 'NoName':
        tmp += '&lt;a href="/process/?objectName=%s"&gt;%s&lt;/a&gt;' % (node.name, node.name)
        tmp += '&lt;/br&gt;'
    return tmp
  </code></pre>
  
  <p>Is there a better way to do that ? Any suggestions please.. </p>