13

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

Flimm
  • 136,138
  • 45
  • 251
  • 267
Sven Rojek
  • 5,476
  • 2
  • 35
  • 57

1 Answers1

15

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']
    }
}
Daniel Samuels
  • 423
  • 7
  • 25
ojii
  • 4,729
  • 2
  • 23
  • 34
  • The structure of the documentation seems to have changed a bit, so for the current stable (v3.1), it's here: http://django-cms.readthedocs.org/en/3.1/reference/configuration.html#cms-placeholder-conf. – dtk May 11 '15 at 11:54