模板中的Django条件详细信息

问题描述

在我的Django应用程序中,有些用户使用department codes,我想向这些用户显示有关模板的不同详细信息,但是超级用户应该可以看到所有内容。这是我的代码:

template.html

{% if user.is_superuser or user.department_code=1%}
<p>Your department code is 1 or you are a superuser</p>
{% elif user.is_superuser or user.department_code=2%}
<p>Your department code is 2 or you are a superuser</p>
{% else %}
<p> You are a superuser</p>
{% endif %}

在这种情况下,我作为超级用户只能看到第一段。我该怎么做呢?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)