django-mpttバージョン(0,5、'+ dev')を使用しました
私のモデルは次のようになります。
class Comment(MPTTModel):
content = models.CharField(max_length = 300)
parent = TreeForeignKey('self', null=True, blank=True, related_name='child')
class MPTTMeta:
order_insertion_by = ['-creation_time']
ここで、コメントモデルのメタを変更します。
class MPTTMeta:
order_insertion_by = ['creation_time']
次に、djangoシェルの下でツリーを再構築し、続いてこれを再構築します。
models.comment.tree.rebuild()
ただし、次のようにスローされます。
AttributeError: type object 'Comment' has no attribute 'tree'
それのどこが悪いんだい?django-mpttでツリーを再構築する方法は?
ありがとう!