Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a placeholder for a specific plugin in django-cms 3.0.0

Tags:

django-cms

How do i create a placeholder that can only be filled with a specific plugin? I'd like to create a template in django-cms 3.0.0.beta2, with a placeholder only for the pictures plugin. I couldn't find any option in the docs.

http://django-cms.readthedocs.org/en/develop/advanced/templatetags.html

like image 604
Sven Rojek Avatar asked Oct 22 '13 09:10

Sven Rojek


1 Answers

Using the placeholder "slot name" (first argument to {% placeholder %} or first argument to PlaceholderField, depending on which you use) and CMS_PLACEHOLDER_CONF you can limit a placeholder to only allow a single type of plugin.

For example: if you have a placeholder in your template which looks like {% placeholder 'main_image' %}, the corresponding CMS_PLACEHOLDER_CONF value in settings.py would be:

CMS_PLACEHOLDER_CONF = {
    'main_image': {
        'plugins': ['PicturePlugin']
    }
}
like image 118
ojii Avatar answered Oct 17 '22 10:10

ojii