fluent_pages.adminui

A set of base classes, to build custom admin pages, for your page types.

These classes are separate from the fluent_pages.admin module on purpose. Custom page type plugins can inherit these classes to provide their enhanced admin interface. If this module could be called fluent_pages.admin, it would invoke the app registry and prevent any further model initialization.

The PageAdmin class

fluent_pages.adminui.PageAdmin

alias of fluent_pages.adminui.pageadmin.DefaultPageChildAdmin

class fluent_pages.adminui.DefaultPageChildAdmin(model, admin_site, *args, **kwargs)

Bases: fluent_pages.adminui.urlnodechildadmin.UrlNodeChildAdmin

The base class for administrating pages. When a custom page type implements a custom admin, use this class as its base. See the code in fluent_pages/pagetypes/*/admin.py for examples. To deal with model inheritence, define the fieldsets using the base_fieldsets option. For example:

base_fieldsets = (
    PageAdmin.FIELDSET_GENERAL,
    PageAdmin.FIELDSET_MENU,
    PageAdmin.FIELDSET_PUBLICATION,
)

By using base_fieldsets instead of the ModelAdmin.fieldsets attribute, any additional fields from a derived model will be displayed in a separate fieldset automatically. The title of the fieldset is configurable with the extra_fieldset_title attribute. It’s “Contents” by default.

The admin class can be extended with mixins by defining FLUENT_PAGES_PARENT_ADMIN_MIXIN / FLUENT_PAGES_CHILD_ADMIN_MIXIN.

base_form

alias of PageAdminForm

base_model

alias of fluent_pages.models.db.Page

formfield_for_foreignkey(db_field, request=None, **kwargs)

Get a form Field for a ForeignKey.

render_change_form(request, context, add=False, change=False, form_url='', obj=None)

Insert the language tabs.

base_change_form_template = 'admin/fluent_pages/page/base_change_form.html'

The default template name, which is available in the template context. Use {% extend base_change_form_template %} in templates to inherit from it.

change_form_template

Dynamic property to support transition to regular models.

This automatically picks admin/parler/change_form.html when the admin uses a translatable model.

The PageAdminForm class

class fluent_pages.adminui.PageAdminForm(*args, **kwargs)

The base class for all admin forms.

This form validates the “Slug” and “Override URL” fields.

The HtmlPageAdmin class

class fluent_pages.adminui.HtmlPageAdmin(model, admin_site, *args, **kwargs)

Bases: fluent_pages.adminui.pageadmin.DefaultPageChildAdmin

The modeladmin configured to display HtmlPage models. The HtmlPage also displays a keywords and description field.

This admin class defines another fieldset: FIELDSET_SEO. The default fieldset layout is:

base_fieldsets = (
    HtmlPageAdmin.FIELDSET_GENERAL,
    HtmlPageAdmin.FIELDSET_SEO,
    HtmlPageAdmin.FIELDSET_MENU,
    HtmlPageAdmin.FIELDSET_PUBLICATION,
)
formfield_for_dbfield(db_field, **kwargs)

Allow formfield_overrides to contain field names too.