Custom InlineModelAdmin subclass used for content types.
alias of ItemEditorForm
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.
Append generated FeinCMS content inlines to native django inlines.
Prepare mapping of content types to their prettified names.
Return extra context parameters for add/change views.
Generate genuine django inlines for registered content types.
Insert FEINCMS_CONTENT_FIELDSET it not present. Is it reasonable to assume this should always be included?
The item editor form contains hidden region and ordering fields and should be used for all content type inlines.
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.
Custom ChangeList class which ensures that the tree entries are always ordered in depth-first order (order by tree_id, lft).
The TreeEditor modifies the standard Django administration change list to a drag-drop enabled interface for django-mptt-managed Django models.
Handle the changelist view, the django view for the model instances change list/actions page.
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.)
alias of MPTTAdminForm
Implement a lookup for object level permissions. Basically the same as ModelAdmin.has_change_permission, but also passes the obj parameter in.
Implement a lookup for object level permissions. Basically the same as ModelAdmin.has_delete_permission, but also passes the obj parameter in.
Generate a short title for an object, indent it depending on the object’s depth in the hierarchy.
Convenience function: Assign the return value of this method to a variable of your ModelAdmin class and put the variable name into list_display.
class MyTreeEditor(TreeEditor): list_display = ('__unicode__', 'active_toggle') active_toggle = ajax_editable_boolean('active', _('is active'))
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).
Return HTML code for a nice representation of true/false.
Customization of ChoicesFilterSpec which sorts in the user-expected format
my_model_field.category_filter = True
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