question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

{% cms_toolbar %} does not work inside a {% block ... %}

See original GitHub issue

I tried this in base.html:

<html>
    ...
</html>
<body>
{% block body_init %}{% endblock %}
...

…and combined it with base_cms.html

{% extends "base.html" %}
{% load cms_tags %}
{% block body_init %}{% cms_toolbar %}{% endblock %}

But I got:

TemplateSyntaxError at /
Invalid block tag: 'endblock'

The problem is that I wanted a base.html that is not dependent on django-cms… I can work around the problem by not caring… but it’d still be nice to be able to host a site where the mother of all templates is not django-cms dependent.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

8reactions
CDAugDevcommented, Aug 26, 2015

I’m not sure if this is still relevant, but I came up with a solution.

Create a single “cms_toolbar.html” file with only this inside:

{% load cms_tags %}

{% cms_toolbar %}

Then, when I want it in one of my many “base.html” files, I call it with an include like so:

{% extends "shared/base.html" %}

{% load cms_tags staticfiles sekizai_tags %}

{# Content #}
{% block base_content %}

    {# Magic #}
    {% include 'shared/cms_toolbar.html' %}

    {% block content %}{% endblock %}

{% endblock base_content %}

Seems to work fine in Django 1.8.3 / Django CMS 3.1.2

0reactions
FinalAngelcommented, Oct 19, 2015

thanks for a possible solution @CDAugDev

Read more comments on GitHub >

github_iconTop Results From Across the Web

{% cms_toolbar %} does not work inside a {% block ... %} #3146
Hi, I don't understand the sentence "So a way may be to have your base.html and a cms_base.html with toolbar that extends base.html"...
Read more >
Toggle Structure in Django-cms toolbar is Disabled
Toggle Structure in Django-cms toolbar is Disabled ... Problem: CMS-toolbar is hiding Navigation bar menus & it's now disabled(not moving up).
Read more >
CAnnot edit block due to interface problems - Concrete CMS
There appears to be an issue editing the block with my custom theme. I have no such issues with autonav. As far as...
Read more >
Remove toolbar from specific category products added as a ...
Go to your theme and locate app/design/frontend/ [ your interface name] / [your theme name] /template/catalog/product/list.phtml.
Read more >
Content blocks - Sitefinity CMS Content management
To open the page, in the toolbar, click Content » Content blocks. Create content blocks. To create a content block: Navigate to Content...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found