Admin classes

ItemEditor

class feincms.admin.item_editor.FeinCMSInline(parent_model, admin_site)

Custom InlineModelAdmin subclass used for content types.

FeinCMSInline.form

alias of ItemEditorForm

class feincms.admin.item_editor.ItemEditor(model, admin_site)

The ItemEditor is a drop-in replacement for ModelAdmin with the speciality of knowing how to work with feincms.models.Base subclasses and associated content types.

It does not have any public API except from everything inherited from’ the standard ModelAdmin class.

ItemEditor.append_feincms_inlines(inline_instances)

Append generated FeinCMS content inlines to native django inlines.

ItemEditor.get_content_type_map()

Prepare mapping of content types to their prettified names.

ItemEditor.get_extra_context(request)

Return extra context parameters for add/change views.

ItemEditor.get_feincms_inlines(model)

Generate genuine django inlines for registered content types.

ItemEditor.get_fieldsets(request, obj=None)

Insert FEINCMS_CONTENT_FIELDSET it not present. Is it reasonable to assume this should always be included?

class feincms.admin.item_editor.ItemEditorForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=u':', empty_permitted=False, instance=None)

The item editor form contains hidden region and ordering fields and should be used for all content type inlines.

feincms.templatetags.feincms_admin_tags.post_process_fieldsets(fieldset)

Removes a few fields from FeinCMS admin inlines, those being id, DELETE and ORDER currently.

Additionally, it ensures that dynamically added fields (i.e. ApplicationContent‘s admin_fields option) are shown.

TreeEditor

class feincms.admin.tree_editor.ChangeList(request, *args, **kwargs)

Custom ChangeList class which ensures that the tree entries are always ordered in depth-first order (order by tree_id, lft).

class feincms.admin.tree_editor.TreeEditor(*args, **kwargs)

The TreeEditor modifies the standard Django administration change list to a drag-drop enabled interface for django-mptt-managed Django models.

TreeEditor.changelist_view(request, extra_context=None, *args, **kwargs)

Handle the changelist view, the django view for the model instances change list/actions page.

TreeEditor.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.)

TreeEditor.form

alias of MPTTAdminForm

TreeEditor.has_change_permission(request, obj=None)

Implement a lookup for object level permissions. Basically the same as ModelAdmin.has_change_permission, but also passes the obj parameter in.

TreeEditor.has_delete_permission(request, obj=None)

Implement a lookup for object level permissions. Basically the same as ModelAdmin.has_delete_permission, but also passes the obj parameter in.

TreeEditor.indented_short_title(item)

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

feincms.admin.tree_editor.ajax_editable_boolean(attr, short_description)

Convenience function: Assign the return value of this method to a variable of your ModelAdmin class and put the variable name into list_display.

Example:

class MyTreeEditor(TreeEditor):
    list_display = ('__unicode__', 'active_toggle')

    active_toggle = ajax_editable_boolean('active', _('is active'))
feincms.admin.tree_editor.ajax_editable_boolean_cell(item, attr, text='', override=None)

Generate a html snippet for showing a boolean value on the admin page. Item is an object, attr is the attribute name we should display. Text is an optional explanatory text to be included in the output.

This function will emit code to produce a checkbox input with its state corresponding to the item.attr attribute if no override value is passed. This input is wired to run a JS ajax updater to toggle the value.

If override is passed in, ignores the attr attribute and returns a static image for the override boolean with no user interaction possible (useful for “disabled and you can’t change it” situations).

feincms.admin.tree_editor.django_boolean_icon(field_val, alt_text=None, title=None)

Return HTML code for a nice representation of true/false.

FilterSpec classes for list_filter customization

class feincms.admin.filterspecs.CategoryFieldListFilter(f, request, params, model, model_admin, field_path=None)

Customization of ChoicesFilterSpec which sorts in the user-expected format

my_model_field.category_filter = True

class feincms.admin.filterspecs.ParentFieldListFilter(f, request, params, model, model_admin, field_path=None)

Improved list_filter display for parent Pages by nicely indenting hierarchy

In theory this would work with any mptt model which uses a “title” attribute.

my_model_field.page_parent_filter = True

Table Of Contents

Previous topic

FeinCMS core

Next topic

Page module

This Page