Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 281 lines (189 sloc) 12.196 kb

API References

cms.api

Python APIs for creating CMS contents. This is done in :mod:`cms.api` and not on the models and managers, because the direct API via models and managers is slightly counterintuitive for developers. Also the functions defined in this module do sanity checks on arguments.

Warning

None of the functions in this module does any security or permission checks. They verify their input values to be sane wherever possible, however permission checks should be implemented manually before calling any of these functions.

Functions and constants

Example workflows

Create a page called 'My Page using the template 'my_template.html' and add a text plugin with the content 'hello world'. This is done in English:

from cms.api import create_page, add_plugin

page = create_page('My Page', 'my_template.html', 'en')
placeholder = page.placeholders.get(slot='body')
add_plugin(placeholder, 'TextPlugin', 'en', body='hello world')

cms.plugin_base

Inherits django.contrib.admin.options.ModelAdmin.

menus.base

A navigation node in a menu tree.

param string title:
  The title to display this menu item with.
param string url:
  The URL associated with this menu item.
param id: Unique (for the current tree) ID of this item.
param parent_id:
  Optional, ID of the parent item.
param parent_namespace:
  Optional, namespace of the parent.
param dict attr:
  Optional, dictionary of additional information to store on this node.
param bool visible:
  Optional, defaults to True, whether this item is visible or not.
Something went wrong with that request. Please try again.