mptt.admin

class mptt.admin.MPTTModelAdmin(model, admin_site)

A basic admin class that displays tree items according to their position in the tree. No extra editing functionality beyond what Django admin normally offers.

change_list_template = 'admin/mptt_change_list.html'
delete_selected_tree(modeladmin, request, queryset)

Deletes multiple instances and makes sure the MPTT fields get recalculated properly. (Because merely doing a bulk delete doesn’t trigger the post_delete hooks.)

form

alias of MPTTAdminForm

formfield_for_foreignkey(db_field, request, **kwargs)
get_actions(request)
get_ordering(request)

Changes the default ordering for changelists to tree-order.

media
class mptt.admin.MPTTAdminForm(*args, **kwargs)

A form which validates that the chosen parent for a node isn’t one of its descendants.

base_fields = OrderedDict()
clean()
declared_fields = OrderedDict()
media
class mptt.admin.DraggableMPTTAdmin(model, admin_site)

The DraggableMPTTAdmin modifies the standard Django administration change list to a drag-drop enabled interface.

change_list_template = None
changelist_view(request, *args, **kwargs)
indented_title(item)

Generate a short title for an object, indent it depending on the object’s depth in the hierarchy.

list_display = ('tree_actions', 'indented_title')
list_per_page = 2000
media
mptt_level_indent = 20
tree_actions(item)