开发者

How to get Permissions to inherit from User's Groups?

I'm trying to figure out Django Groups and the documentation is pretty bare on the site.

For example, you can use the decorator permission_required() to check the permissions, however, this only checks if you have assigned permissions directly. I have assigned Users to Groups which have Permissions setup. When using Django's permissions system, it ignores the Groups the User belongs to.

Is there any way to get Django to inherit permissions from the User's G开发者_如何学Pythonroups?


Django does automatically inherit permissions from groups. There may be some problem in your installation or database (such as using a custom permission without having done a syncdb), or you might be passing the wrong argument to the decorator.

If you have a model named post in an app named blog for example, the decorator would be used like this:

@permission_required('blog.delete_post')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜