Django-CMS - Global placeholder?

django, django-cms, placeholder

Solution

I usually create a page in my CMS that isn't published, but contains placeholders that I would like to use elsewhere (footer/headers) etc.

Make a new template extra_placeholders.html:

{% extends "base.html" %}
{% load cms_tags %}

{% block content %}
    {% placeholder "Banner-List" %}
{% endblock %}

add it to your settings:

CMS_TEMPLATES = (
    ('my/path/extra_placeholders.html', 'Extra Placeholder Page'),
    ...
)

now go to the admin and create the placeholder with whatever plugin you want. Then go to you base template (*base.html probably) from which all your other pages inherit and add this wherever you want the placeholder to appear:

{% load cms_tags %}
...
{% show_placeholder "Banner-List" "extra_placeholders" %}

You can read more about it in the docs

EDIT

As @José L. Patiño has mentioned in the comments, this solution is only necessary for those using `django-cms` < 3.0. For the newer version you can simply use the `static_placeholder` template tag

Problem

Is there any way to make global placeholder in my base template? I need it to be the same on every page (banners list). How can I do that?

Original source