modeltree.tree.ModelTree

Arguments

  • model (required) - Model class this tree represents and is relative to. This is also referred to as the root model.
  • alias - Alternate name of this modeltree when accessing it via modeltree.tree.trees
  • excluded_models - Models to exclude in the traversal
  • required_routes - Required join route between two models. Read more about routes
  • excluded_routes - Excluded join route between two models. Read more about routes

Methods

query_string(model)

Returns the lookup string from the root model to model.

query_string_for_field(field, operator=None)

Returns the lookup string from the root model to field. For convenience, an operator can be supplied when constructing query filters.

query_condition(field, operator, value)

Returns a django.db.models.Q object based on the arguments passed and relative to the root model.