私は持っている:
Home
Things with Fur
Dog
Horse
Basket Ball Games
Twenty One
Horse
slugfor each がであると仮定するとtitle.lower().replace(' ', '-')、私の URL は次のようになります。
/home/
/home/things-with-fur/
/home/things-with-fur/dog/
/home/things-with-fur/horse/
/home/basket-ball-games/
/home/basket-ball-games/twenty-one/
/home/basket-ball-games/horse/
slugフィールドunique_togetherにはparent.
URL セグメントに基づいて、正しいカテゴリを照会する必要があります。horseでバスケットボールの試合を単純にクエリすることはできませんCategory.objects.get(mptt_level=2, slug=u'horse')。たまたまhorse別のカテゴリの下にスラッグがあるカテゴリがあるためですが、同じレベルにあります。horseでは、チェーンを上って各レベルをチェックすることなく、自分のカテゴリを正しくクエリするにはどうすればよいでしょうか?