Django CMS 3 Detect if I am facing 'structure&

2019-04-29 20:40发布

问题:

Django CMS 3 has two modes: structure and content.

I need to detect if the user is using one or the other in order to apply specific css.

Is there a way to to this?

回答1:

You can detect the current mode via request.toolbar.build_mode and request.toolbar.edit_mode like this:

{% if request.toolbar.build_mode %}
    We're in structure mode!
{% elif request.toolbar.edit_mode %}
    We're in content mode !
{% else %}
    We're not in edit mode!
{% endif %}


标签: django-cms