Django CMS 3 Detect if I am facing 'structure' or 'content'

£可爱£侵袭症+ 提交于 2020-01-13 10:25:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!