The admin classes of fluent_contents provide the necessary integration with existing admin interfaces.

The placeholder interfaces are implemented by model admin inlines, so they can be added to almost any admin interface. To assist in configuring the admin interface properly, there are a few base classes:

Both classes ensure the placeholders and inlines are properly setup.

The PlaceholderEditorAdmin class

class fluent_contents.admin.PlaceholderEditorAdmin(model, admin_site)

The base functionality for ModelAdmin dialogs to display a placeholder editor with plugins. It loads the inlines using get_extra_inlines().

It loads the PlaceholderEditorInline, which displays each placeholder in separate tabs:

django-fluent-contents placeholder editor preview

Return the extra inlines for the placeholder editor. It loads the placeholder_inline first, followed by the inlines for the ContentItem classes.

get_inline_instances(request, *args, **kwargs)

Create the inlines for the admin, including the placeholder and contentitem inlines.

get_placeholder_data_view(request, object_id)

Return the placeholder data as dictionary. This is used in the client for the “copy” functionality.


alias of PlaceholderEditorInline

save_formset(request, form, formset, change)

Given an inline formset save it to the database.

The PlaceholderFieldAdmin class

class fluent_contents.admin.PlaceholderFieldAdmin(model, admin_site)

The base functionality for ModelAdmin dialogs to display placeholder fields.

This class loads the ContentItem inlines, and initializes the frontend editor for the PlaceholderField. The placeholder will be displayed in the admin:

django-fluent-contents placeholder field preview
formfield_for_dbfield(db_field, **kwargs)

Hook for specifying the form Field instance for a given database Field instance.

If kwargs are given, they’re passed to the form Field’s constructor.


Return which plugins are allowed by the placeholder fields.

get_form(request, obj=None, **kwargs)

Return a Form class for use in the admin add view. This is used by add_view and change_view.

get_placeholder_data(request, obj=None)

Return the data of the placeholder fields.


alias of PlaceholderFieldInline

The PlaceholderEditorBaseMixin class

class fluent_contents.admin.PlaceholderEditorBaseMixin

Base interface/mixin for a ModelAdmin to provide the PlaceholderEditorInline with initial data. This class is implemented by the PlaceholderEditorAdmin and PlaceholderFieldAdmin classes.


Return all plugin categories which can be used by placeholder content. By default, all plugins are allowed. Individual slot names may further limit the plugin set.

Return type:list of ContentPlugin
get_placeholder_data(request, obj=None)

Return the placeholders that the editor should initially display. The function should return a list of PlaceholderData classes. These classes can either be instantiated manually, or read from a template using the fluent_contents.analyzer module for example.

The PlaceholderEditorInline class

class fluent_contents.admin.PlaceholderEditorInline(parent_model, admin_site)

The placeholder editor, implemented as an admin inline. It displays tabs for each inline placeholder, and displays ContentItem plugins in the tabs.

It should be inserted in the ModelAdmin.inlines before the inlines that the get_content_item_inlines() function generates. The ContentItem inlines look for the Placeholder object that was created just before their invocation.

To fetch the initial data, the inline will attempt to find the parent model, and call get_placeholder_data(). When the admin models inherit from PlaceholderEditorAdmin or PlaceholderFieldAdmin this will be setup already.


alias of PlaceholderInlineFormSet


Return all plugin categories which can be used by placeholder content. This is the sum of all allowed plugins by the various slots on the page. It accesses the parent PlaceholderEditorBaseMixin by default to request the information. This field is used in the template.

get_formset(request, obj=None, **kwargs)

Pre-populate formset with the initial placeholders to display.


alias of fluent_contents.models.db.Placeholder

The get_content_item_inlines function

fluent_contents.admin.get_content_item_inlines(plugins=None, base=<class 'fluent_contents.admin.contentitems.BaseContentItemInline'>)

Dynamically generate genuine django inlines for all registered content item types. When the plugins parameter is None, all plugin inlines are returned.