generic.backend module¶
- class generic.backend.BlacklistBackend[源代码]¶
基类:
AllowAllUsersModelBackend
在django自带的认证后端的基础上,除去在黑名单中记录的用户权限。
- with_perm(perm: str | Permission, is_active: bool = True, include_superusers: bool = True, obj=None) QuerySet [源代码]¶
返回所有具有perm权限的用户列表。默认要求用户is_active,且包括超级用户。
- 参数:
perm (str | Permission) -- 权限,字符串格式为app_label.codename
is_active (bool, optional) -- 是否要求用户是激活状态,默认为True
include_superusers (bool, optional) -- 是否包括超级用户
obj (Any, optional) -- 查询对于某一个特定的对象的权限,父类暂不支持
- 返回:
具有权限的用户集合