Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DjangoCMS: how to auto-add default plugins in placeholders

I have a few placeholders in my DjangoCMS template (par example, header, contetent and footer). I want to automatically populate any newly-created pages with default items: header placeholder with header plugin and footer placeholder with footer plugin.

How can it be done?

like image 607
Felix Avatar asked Jan 18 '26 22:01

Felix


1 Answers

This can be done using the CMS_PLACEHOLDER_CONF setting, specifically, the default_plugins option:

CMS_PLACEHOLDER_CONF = {
    'footer': {
        'name': "Footer",
        'default_plugins':[
            {
                'plugin_type':'FooterPlugin',
                'values':{
                    'body':'<p>This is the footer</p>'
                },
            },
        ]
    },
}

This assumes that your FooterPlugin has a field body that allows HTML content.

like image 159
Benjamin Wohlwend Avatar answered Jan 20 '26 12:01

Benjamin Wohlwend