[Fixed]-Django CMS Placeholder: Plugin Blacklist

0👍

Currently, you can only whitelist plugins, not blacklist them. This means that for now, you have to specify the list of all plugins (except your custom plugin) on all other placeholders (note you can select all placeholders in a template by using the template as key), and define the list for your static placeholder that includes your custom plugin.

It might also be worth it to raise this on the django CMS Issue Tracker to maybe find a better solution in future versions.

👤ojii

1👍

A follow-up on ojii’s answer:

Although it’s currently being approved for merge (see #5412), the method described by yakky will be as follows:

To implement blacklist, add the plugin to be blacklisted in CMS_PLACEHOLDER_CONF[None]['excluded_plugins'] list

See #4979

Thank you @yakky 🙂

EDIT: More information pulled from Issue #5412:

Sometimes a global configuration would make things much nicer /
simpler

@ojii suggested a for level structure like (in increasing
order of precedence)

CMS_PLACEHOLDER_CONF[None] (global)

CMS_PLACEHOLDER_CONF['template'] (if template is given)

CMS_PLACEHOLDER_CONF['placeholder']

CMS_PLACEHOLDER_CONF['template placeholder'] (if template is given)

EDIT 2 Tried these new configurations on Django CMS 3.4.0 and it worked flawlessly

CMS_PLACEHOLDER_CONF = {
    'About': {
        'excluded_plugins': ['CMSArticlePlugin', 'FormPlugin'],
    },
    'Contact': {
        'excluded_plugins': ['CMSArticlePlugin'],
    },
    'Editions': {
        'excluded_plugins': ['CMSArticlePlugin', 'FormPlugin'],
    },
    'Involved': {
        'excluded_plugins': ['CMSArticlePlugin', 'FormPlugin'],
    },
    'Gallery': {
        'excluded_plugins': ['CMSArticlePlugin', 'FormPlugin'],
    },
    'News': {
        'excluded_plugins': ['FormPlugin'],
    },
}

Great job, Django CMS Team!

Leave a comment