Admin classes

New in version 0.4.

To add admin functionality to your tree model, use one of the ModelAdmin classes in django-mptt.admin:

MPTTModelAdmin

This is a bare-bones tree admin. All it does is enforce ordering, and indent the nodes in the tree to make a pretty tree list view.

Usage:

from django.contrib import admin
from mptt.admin import MPTTModelAdmin
from myproject.myapp.models import Node

admin.site.register(Node, MPTTModelAdmin)

You can change the indent pixels per level by putting this in your settings.py:

# default is 10 pixels
MPTT_ADMIN_LEVEL_INDENT = 20

FeinCMSModelAdmin

This requires FeinCMS to be installed.

In addition to enforcing ordering and indenting the nodes, it has:

  • Javascript expand/collapse for parent nodes
  • Javascript widgets for moving nodes on the list view page

Table Of Contents

Previous topic

Models and Managers

Next topic

Working with trees in django.forms

This Page