0

I am using django mptt for tree structure. I ma adding parent to any object while updating not creating any object as shown below .

user= User.objects.create(username='abc') 

after some logics or steps when we are sure that it can be added as a child of some user the I am updating the user instance.

User.objects.filter(pk=user.pk).update(parent=parent_user_instance)

user is added as the parent and when I'll do user.get_siblings() I'll get all siblings but when I'll do user.get_family() then it fails to fetch its ancestors or descendant .

two important things here are :

1 ) Built in User model (django auth_user) of django is extended to enable mptt .

2 ) I am adding parent through update() not create() # I am not sure update() have something to do with the issue.

user5594493
  • 1,050
  • 3
  • 10
  • 24

0 Answers0