Toggle table of contents sidebar
Placeholders¶Bases: Model
Placeholders
can be filled with plugins, which store or generate content.
Added in version 4.0.
Adds a plugin to the placeholder. The plugin’s position field must be set to the target position. Positions are enumerated from the start of the palceholder’s plugin tree (1) to the last plugin (n, where n is the number of plugins in the placeholder).
instance (cms.models.pluginmodel.CMSPlugin
instance) – Plugin to add. It’s position parameter needs to be set.
Note
As of version 4 of django CMS the position counter does not re-start at 1 for the first child plugin. The position
field and language
field are unique for a placeholder.
Example:
new_child = MyCoolPlugin() new_child.position = ( parent_plugin.position + 1 ) # add as first child: directly after parent parent_plugin.placeholder.add(new_child)
Deletes all plugins from the placeholder
Added in version 4.0.
Removes a plugin and its descendants from the placeholder and database.
instance (cms.models.pluginmodel.CMSPlugin
instance) – Plugin to add. It’s position parameter needs to be set.
Returns the number of seconds (from «response_timestamp») that this placeholder can be cached. This is derived from the plugins it contains.
This method must return: EXPIRE_NOW <= int <= MAX_EXPIRATION_IN_SECONDS
Returns language objects for every language for which the placeholder has plugins.
This is not cached as it’s meant to be used in the frontend editor.
Added in version 4.0.
Helper to calculate plugin positions correctly.
language (str) – language for which the position is to be calculated
parent (cms.models.pluginmodel.CMSPlugin
instance) – Parent plugin or None
(if position is on top level)
insert_order (str) – Either "first"
(default) or "last"
Returns a list of plugin ids matching the given language ordered by plugin position.
Returns a queryset of plugins attached to this placeholder. If language is given only plugins in the given language are returned.
Returns a list of plugins attached to this placeholder. If language is given only plugins in the given language are returned.
Returns a list of VARY headers.
Returns True
if user has permission to add plugin_type
to this placeholder.
Returns True
if user has permission to add all plugins in plugins
to this placeholder.
Returns True
if user has permission to change all models attached to this placeholder.
Returns True
if user has permission to change plugin
to this placeholder.
Returns True
if user has permission to delete all plugins in this placeholder
Returns True
if user has permission to delete plugin
to this placeholder.
Returns True
if user has permission to delete all plugins in this placeholder
Returns True
if user has permission to move plugin
to the target_placeholder
.
Checks if placeholder is empty (False
) or populated (True
)
Added in version 4.0.
Moves a plugin within the placeholder (target_placeholder=None
) or to another placeholder.
plugin (cms.models.pluginmodel.CMSPlugin
instance) – Plugin to move
target_position (int) – The plugin’s new position
target_placeholder (cms.models.placeholdermodel.Placeholder
instance) – Placeholder to move plugin to (or None
)
target_plugin (cms.models.pluginmodel.CMSPlugin
instance) – New parent plugin (or None
). The target plugin must be in the same placeholder or in the target_placeholder
if one is given.
The target_position
is enumerated from the start of the palceholder’s plugin tree (1) to the last plugin (n, where n is the number of plugins in the placeholder).
Flag caching the palceholder’s content
A default width is passed to the templace context as width
If False the content of the placeholder is not editable in the frontend
Set to “True” for static placeholders (by the template tag)
Gives the page object if the placeholder belongs to a cms.models.titlemodels.PageContent
object (and not to some other model.) If the placeholder is not attached to a page it returns None
slot name that appears in the frontend
Adding FrontendEditableAdminMixin
to models admin class allows to open that admin in the frontend by double-clicking on fields rendered with the render_model
template tag.
Register the url for the edit field view
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4