mptt.fields
¶
Model fields for working with trees.
-
class
mptt.fields.
TreeForeignKey
(to, on_delete=None, related_name=None, related_query_name=None, limit_choices_to=None, parent_link=False, to_field=None, db_constraint=True, **kwargs)¶ Extends the foreign key, but uses mptt’s
TreeNodeChoiceField
as the default form field.This is useful if you are creating models that need automatically generated ModelForms to use the correct widgets.
-
formfield
(**kwargs)¶ Use MPTT’s
TreeNodeChoiceField
-