django 1.1 模板中的权限问题

发布于 2024-09-10 18:00:32 字数 323 浏览 4 评论 0原文

我有一个应用程序,可以让用户为具有不同权限的用户过滤某些内容。

由于某种原因,Django 1.1 似乎无法识别这些。

我有一个名为corporate 的组,并且根据需要授予权限

现在在我的模板中我渲染以下内容。

{% if perms.corporate %}
...显示以下内容
{% 其他 %}
...显示其他内容
{% endif %}

为什么这没有呈现我想要的信息?

I have an app that makes user of filtering certain things for users with different permissions.

Django 1.1 does for some reason not seem to recognize these.

I have a group called corporate and permissions are granted as needed.

now in my template I am render the following.

{% if perms.corporate %}
...show the following
{% else %}
... show something else
{% endif %}

why is this not rendering the info I want?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨后咖啡店 2024-09-17 18:00:32

perms.corporate 代理 User.has_module_perms('corporate')。因此,您需要有一个标记为“corporate”的模块(或应用程序)。你说你现在的公司是一个集团,所以这可能行不通。

perms.corporate proxies to User.has_module_perms('corporate'). So you need to have a module (or app) labeled corporate. You say your current corporate is a group, so this probably won't work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文