-
这个 mixin 就像
permission_required
装饰器一样,检查访问视图的用户是否拥有所有给定的权限。您应该使用permission_required
参数指定权限(或可迭代的权限):from django.contrib.auth.mixins import PermissionRequiredMixin class MyView(PermissionRequiredMixin, View): permission_required = 'polls.add_choice' # Or multiple of permissions: permission_required = ('polls.view_choice', 'polls.change_choice')
您可以设置
AccessMixin
您还可以覆盖这些方法:
本文介绍 django.contrib.auth.mixins.PermissionRequiredMixin
的用法。
声明
class PermissionRequiredMixin
相关用法
- Python Sympy Permutation.list()用法及代码示例
- Python Sympy Permutation.rank_nonlex()用法及代码示例
- Python Sympy Permutation.next_lex()用法及代码示例
- Python Sympy Permutation.is_odd()用法及代码示例
- Python Sympy Permutation.support()用法及代码示例
- Python Sympy Permutation.runs()用法及代码示例
- Python Sympy Permutation.signature()用法及代码示例
- Python Sympy Permutation.max()用法及代码示例
- Python Sympy Permutation.mul_inv()用法及代码示例
- Python Sympy Permutation.unrank_nonlex()用法及代码示例
- Python Sympy Permutation.is_Empty()用法及代码示例
- Python Sympy Permutation.is_Identity()用法及代码示例
- Python Sympy Permutation.random()用法及代码示例
- Python Sympy Permutation.rmul_with_af()用法及代码示例
- Python Sympy Permutation.unrank_lex()用法及代码示例
- Python Sympy Permutation.transpositions()用法及代码示例
- Python Sympy Permutation.rmul()用法及代码示例
- Python Sympy Permutation.next_trotterjohnson()用法及代码示例
- Python Sympy Permutation.is_even()用法及代码示例
- Python Sympy Permutation.order()用法及代码示例
- Python Sympy Permutation.length()用法及代码示例
- Python Sympy Permutation.unrank_trotterjohnson()用法及代码示例
- Python Sympy Permutation.parity()用法及代码示例
- Python Sympy Permutation.rank()用法及代码示例
- Python Sympy Permutation.inversions()用法及代码示例
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.contrib.auth.mixins.PermissionRequiredMixin。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。