Admin classes (feincms3.admin)

class feincms3.admin.AncestorFilter(request, params, model, model_admin)[source]

Only show the subtree of an ancestor

By default, the first two levels are shown in the list_filter sidebar. This can be changed by setting the max_depth class attribute to a different value.

Usage:

class NodeAdmin(TreeAdmin):
    list_display = ("indented_title", "move_column", ...)
    list_filter = ("is_active", AncestorFilter, ...)

admin.site.register(Node, NodeAdmin)
lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class feincms3.admin.CloneForm(*args, **kwargs)[source]
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

property media

Return all media required to render the widgets on this form.

class feincms3.admin.MoveForm(*args, **kwargs)[source]

Allows making the node the left or right sibling or the first or last child of another node.

Requires the node to be moved as obj keyword argument.

clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

property media

Return all media required to render the widgets on this form.

class feincms3.admin.TreeAdmin(model, admin_site)[source]

ModelAdmin subclass for managing models using django-tree-queries trees.

Shows the tree’s hierarchy and adds a view to move nodes around. To use this class the three columns collapse_column, indented_title and move_column should be added to subclasses list_display:

class NodeAdmin(TreeAdmin):
    list_display = [*TreeAdmin.list_display, ...]
    # This is the default:
    # list_display_links = ["indented_title"]

admin.site.register(Node, NodeAdmin)
changelist_view(request, **kwargs)[source]

The ‘change list’ admin view for this model.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

get_urls()[source]

Add our own move view.

indented_title(instance, *, ellipsize=True)[source]

Use Unicode box-drawing characters to visualize the tree hierarchy.

move_column(instance)[source]

Show a move link which leads to a separate page where the move destination may be selected.