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