-
這個 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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。