Is it possible to have a tree for each user? I was trying something like this

# ----- models.py ------ #
from django.db import Models
from django.contrib.auth.models import User
from treebeard.mp_tree import MP_Node

class MyTree(MP_Node):
    user = models.ForeignKey(User)
    desc = models.CharField(max_length=255)

    def __unicode__(self):
        return self.desc

    class Meta:
        unique_together = [('path', 'user')]

# ----- admin.py ----- #
from django.contrib import admin
from myProject.myApp.models import MyTree
from treebeard.admin import TreeAdmin

class MyTreeAdmin(TreeAdmin):
    list_filter = (
        'user',
    )

admin,site.register(MyTree, MyTreeAdmin)

# ----- end of admin.py ------ #

But the path gets kind of messed up and I get IntegrityErrors.
Also in the admin interface filtering by user is ignored by the tree interface.

What am I doing wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to