4. API References

4.1. cms.plugin_base

class cms.plugin_base.CMSPluginBase

Inherits django.contrib.admin.options.ModelAdmin.

admin_preview

Defaults to True, if False no preview is done in the admin.

change_form_template

Custom template to use to render the form to edit this plugin.

form

Custom form class to be used to edit this plugin.

model

Is the CMSPlugin model we created earlier. If you don’t need a model because you just want to display some template logic, use CMSPlugin from cms.models as the model instead.

module

Will be group the plugin in the plugin editor. If module is None, plugin is grouped “Generic” group.

name

Will be displayed in the plugin editor.

render_plugin

If set to False, this plugin will not be rendered at all.

render_template

Will be rendered with the context returned by the render function.

text_enabled

Whether this plugin can be used in text plugins or not.

icon_alt(instance)

Returns the alt text for the icon used in text plugins, see icon_src().

icon_src(instance)

Returns the url to the icon to be used for the given instance when that instance is used inside a text plugin.

render(context, instance, placeholder)

This method returns the context to be used to render the template specified in render_template.

Parameters:
  • context – Current template context.
  • instance – Plugin instance that is being rendered.
  • placeholder – Name of the placeholder the plugin is in.
Return type:

dict

class PluginMedia

Defines media which is required to render this plugin.

css

The CSS files required to render this plugin as a dictionary with the display type as keys and a sequence of strings as values.

js

The Javascript files required to render this plugin as a sequence of strings.

4.2. menus.base

A navigation node in a menu tree.

Parameters:
  • title (string) – The title to display this menu item with.
  • url (string) – The URL associated with this menu item.
  • id – Unique (for the current tree) ID of this item.
  • parent_id – Optional, ID of the parent item.
  • parent_namespace – Optional, namespace of the parent.
  • attr (dict) – Optional, dictionary of additional information to store on this node.
  • visible (bool) – Optional, defaults to True, whether this item is visible or not.

Table Of Contents

Previous topic

3. App Integration

Next topic

5. Placeholders outside the CMS

This Page