Page extensions and page content extensions

Extensions

class cms.extensions.models.PageExtension(*args, **kwargs)
class cms.extensions.models.PageContentExtension(*args, **kwargs)

Admin

class cms.extensions.admin.PageExtensionAdmin(model, admin_site)
add_view(request, form_url='', extra_context=None)

Check if the page already has an extension object. If so, redirect to edit view instead.

delete_model(request, obj)

Given a model instance delete it from the database.

get_model_perms(request)

Return empty perms dict thus hiding the model from admin index.

save_model(request, obj, form, change)

Given a model instance save it to the database.

class cms.extensions.admin.PageContentExtensionAdmin(model, admin_site)
add_view(request, form_url='', extra_context=None)

Check if the page already has an extension object. If so, redirect to edit view instead.

delete_model(request, obj)

Given a model instance delete it from the database.

get_model_perms(request)

Return empty perms dict thus hiding the model from admin index.

save_model(request, obj, form, change)

Given a model instance save it to the database.

Toolbar

class cms.extensions.toolbar.ExtensionToolbar(request, toolbar, is_current_app, app_path)

Offers simplified API for providing the user access to the admin of page extensions and page content extensions through the toolbar.

get_page_content_extension_admin(page_content_obj=None)

Get the admin url for the page content extensions menu item, depending on whether a PageContentExtension instance exists for the PageContent displayed.

Return a tuple of the page content extension and the url; the extension is None if no instance exists, the url is None if no admin is registered for the extension. If there is no page content, both values are None.

get_page_extension_admin()

Get the admin url for the page extension menu item, depending on whether a PageExtension instance exists for the current page or not.

Return a tuple of the current extension and the url; the extension is None if no instance exists, the url is None is no admin is registered for the extension.

get_title_extension_admin(language=None)

Deprecated.

Reflects now obsolete behavior in django CMS 3.x:

Get the admin urls for the page content extensions menu items, depending on whether a PageContentExtension instance exists for each PageContent in the current page. A single language can be passed to only work on a single page content object.

Return a list of tuples of the page content extension and the url; the extension is None if no instance exists, the url is None is no admin is registered for the extension.