modeltree.managers.ModelTreeManager

This manager is a light wrapper which allows use of the ModelTree lookup syntax with Django's standard QuerySet/manager methods.

Arguments

  • tree - An alias of a tree for the bound model. This is only necessary if more than one tree is defined for a given model.

Example

# settings.py
MODELTREES = {
    'default': {
        'model': 'app.Foo',
        ...
    },
    'custom': {
        'models': 'app.Foo',
        ...
    }
}

# app/models.py
from modeltree.managers.ModelTreeManager

class Foo(models.Model):
    # fields...

    objects = ModelTreeManager()
    custom_manager = ModelTreeManager('custom')