我正在使用 django-mptt 0.4.2,并想重建一棵树。
树管理器有一个方法rebuild(),我尝试像这样访问它:
>>> my_rootnode = MyObj.objects.get(id=12)
>>> my_rootnode.tree.rebuild()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 211, in __get__
raise AttributeError("Manager isn't accessible via %s instances" % type.__name__)
AttributeError: Manager isn't accessible via MyObj instances
我显然做错了。我应该如何访问重建方法?