问题
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 %}
来源:https://stackoverflow.com/questions/28191037/django-cms-3-detect-if-i-am-facing-structure-or-content