title: Django, how to do CRUD with django-mptt?
body: <p>How we can implement CRUD functionality using <strong>generic views</strong> and <strong>django-mptt</strong> ?? I've searched a lot and couldn't find a single tutorial/sample code.</p>
  
  <p>Let's say we have a Course hierarchy or Category hierarchy, or similar thing ... How we can Add/Delete/Update/Read them ??</p>
  
  <p>For instance I have this model:</p>
  
  <pre><code>from django.db import models
  from mptt.models import MPTTModel , TreeForeignKey
  
  
  class Genre(MPTTModel):
      name            = models.CharField(max_length = 50 , unique = True)
      parent          = TreeForeignKey('self' , null = True , blank = True , related_name = 'children')
  
      class MPTTMeta:
          order_insertion_by = ['name']
  </code></pre>
  
  <p>and this views.py:</p>
  
  <pre><code>from django.views.generic.list_detail import object_list
  from mp.models import Genre
  
  def genres_list(request):
      ''' Shows all of the genres '''
      return object_list(request,
              queryset = Genre.tree.all() ,
              template_name = 'genres.html' ,
              # template_object_name = 'nodes' ## Adding "nodes" variable didn't solve the problem
      )
  </code></pre>
  
  <p>well ... I get this error (error is in line number "5" :  {% recursetree nodes %}):</p>
  
  <pre><code>Caught VariableDoesNotExist while rendering: Failed lookup for key [nodes] in u"[{'paginator': None, 'is_paginated': False, 'page_obj': None, 'nodes_list': [&lt;Genre: Genre object&gt;, &lt;Genre: Genre object&gt;, &lt;Genre: Genre object&gt;, &lt;Genre: Genre object&gt;]}, {'csrf_token': &lt;django.utils.functional.__proxy__ object at 0x7f5bb810f090&gt;}, {'perms': &lt;django.utils.functional.__proxy__ object at 0x7f5bb810ff10&gt;, 'messages': &lt;django.contrib.messages.storage.user_messages.LegacyFallbackStorage object at 0x324af50&gt;, 'user': ....................................
  
      &lt;html&gt;
  2   
  3       {% load mptt_tags %}
  4       &lt;ul&gt;
  5           {% recursetree nodes %}
  6           &lt;li&gt;
  7               {{node.name}}
  </code></pre>