Models

class cms.models.``Page

A Page is the basic unit of site structure in django CMS. The CMS uses a hierachical page model: each page stands in relation to other pages as parent, child or sibling.

class cms.models.``Title

class cms.models.``Placeholder

Placeholders can be filled with plugins, which store or generate content.

class cms.models.``CMSPlugin

See also: Storing configuration

Attributes

  • translatable_content_excluded_fields

Default: [ ]

A list of plugin fields which will not be exported while using get_translatable_content().

See also: get_translatable_content(), set_translatable_content().

Methods

  • copy_relations()

    Handle copying of any relations attached to this plugin. Custom plugins have to do this themselves.

    copy_relations takes 1 argument:

    • old_instance: The source plugin instance

    See also: Handling Relations, post_copy().

  • get_translatable_content()

    Get a dictionary of all content fields (field name / field value pairs) from the plugin.

    Example:

    1. from djangocms_text_ckeditor.models import Text
    2. plugin = Text.objects.get(pk=1).get_plugin_instance()[0]
    3. plugin.get_translatable_content()
    4. # returns {'body': u'<p>I am text!</p>\n'}

    See also: translatable_content_excluded_fields, set_translatable_content.

  • post_copy()

    Can (should) be overridden to handle the copying of plugins which contain children plugins after the original parent has been copied.

    post_copy takes 2 arguments:

    • old_instance: The old plugin instance instance
    • new_old_ziplist: A list of tuples containing new copies and the old existing child plugins.

    See also: Handling Relations, copy_relations().

  • set_translatable_content()

    Takes a dictionary of plugin fields (field name / field value pairs) and overwrites the plugin’s fields. Returns True if all fields have been written successfully, and False otherwise.

    set_translatable_content takes 1 argument:

    Example:

    1. from djangocms_text_ckeditor.models import Text
    2. plugin = Text.objects.get(pk=1).get_plugin_instance()[0]
    3. plugin.set_translatable_content({'body': u'<p>This is a different text!</p>\n'})
    4. # returns True

    See also: translatable_content_excluded_fields, get_translatable_content().

  • get_add_url()

    Returns the URL to call to add a plugin instance; useful to implement plugin-specific logic in a custom view.

  • get_edit_url()

    Returns the URL to call to edit a plugin instance; useful to implement plugin-specific logic in a custom view.

  • get_move_url()

    Returns the URL to call to move a plugin instance; useful to implement plugin-specific logic in a custom view.

  • get_delete_url()

    Returns the URL to call to delete a plugin instance; useful to implement plugin-specific logic in a custom view.

  • get_copy_url()

    Returns the URL to call to copy a plugin instance; useful to implement plugin-specific logic in a custom view.

  • add_url()

    Returns the URL to call to add a plugin instance; useful to implement plugin-specific logic in a custom view.

    This property is now deprecated. Will be removed in 3.4. Use the get_add_url method instead.

    Default: None (cms_page_add_plugin view is used)

  • edit_url()

    Returns the URL to call to edit a plugin instance; useful to implement plugin-specific logic in a custom view.

    This property is now deprecated. Will be removed in 3.4. Use the get_edit_url method instead.

    Default: None (cms_page_edit_plugin view is used)

  • move_url()

    Returns the URL to call to move a plugin instance; useful to implement plugin-specific logic in a custom view.

    This property is now deprecated. Will be removed in 3.4. Use the get_move_url method instead.

    Default: None (cms_page_move_plugin view is used)

  • delete_url()

    Returns the URL to call to delete a plugin instance; useful to implement plugin-specific logic in a custom view.

    This property is now deprecated. Will be removed in 3.4. Use the get_delete_url method instead.

    Default: None (cms_page_delete_plugin view is used)

  • copy_url()

    Returns the URL to call to copy a plugin instance; useful to implement plugin-specific logic in a custom view.

    This property is now deprecated. Will be removed in 3.4. Use the get_copy_url method instead.

    Default: None (cms_page_copy_plugins view is used)

Model fields

class cms.models.fields.``PageField

This is a foreign key field to the cms.models.Page model that defaults to the cms.forms.fields.PageSelectFormField form field when rendered in forms. It has the same API as the django.db.models.ForeignKey but does not require the othermodel argument.

class cms.models.fields.``PlaceholderField

A foreign key field to the cms.models.Placeholder model.