Closed GoogleCodeExporter closed 9 years ago
It seems that simply save my model again do the trick... Thx for mptt
from myapp.models import Category
c = Category(id=0, order=1).save()
for c in Category.objects.all():
if c.parent_id == 0:
c.parent = None
c.save()
c.delete()
Original comment by batiste....@gmail.com
on 25 Nov 2008 at 2:19
In fact I was wrong, it's not working:
>>> category.get_descendants()
[]
>>> category.children.all()
[<Category: cat1>, ..., <Category: cat6>]
Any idea how to fix that?
Original comment by batiste....@gmail.com
on 27 Nov 2008 at 9:44
Patch in issue#13 (by me) adds a magic Model.tree.rebuild() method for you :).
Original comment by mocksoul
on 6 Dec 2008 at 12:19
Hey man, thanks lot!
Original comment by batiste....@gmail.com
on 6 Dec 2008 at 1:21
Original comment by craig.ds@gmail.com
on 2 Sep 2010 at 12:23
Original issue reported on code.google.com by
batiste....@gmail.com
on 25 Nov 2008 at 2:06