1

I have the model:

from treebeard.ns_tree import NS_Node
class Category(NS_Node):
    name = models.CharField(max_length=30)
    node_order_by = ['id']

    def __str__(self):
        return self.name

and i try create new root element:

>>>from index.models import Category
>>>get = lambda node_id: Category.objects.get(pk=node_id)
>>>last_root = Category.get_last_root_node()
>>>get(last_root.pk).add_sibling(pos='sorted-sibling', name='ROOT2')

the following error:

Exception Value:    
Cannot use None as a query value
Exception Location: e:\work\newsklad\lib\site-packages\django\db\models\sql\query.py in prepare_lookup_value, line 995

how remove this bag?

1 Answers1

0

You should probably use use NS_Node.add_root, but your more immediate issue is that pos is a positional argument not a keyword one.

get(last_root.pk).add_sibling('sorted-sibling', name='ROOT2')
Will S
  • 744
  • 8
  • 17