Appointment.utils.identity module¶
文件名: identity.py 负责人: pht
包含与身份有关的工具函数
依赖于app.API
- Appointment.utils.identity.get_auditor_ids(participant: Participant | User)[源代码]¶
返回participant的审核者id列表
- Appointment.utils.identity.get_avatar(participant: Participant | User)[源代码]¶
返回participant的头像
- Appointment.utils.identity.get_member_ids(participant: Participant | User, noncurrent: bool = False)[源代码]¶
返回participant的成员id列表,个人返回空列表
- Appointment.utils.identity.get_name(participant: Participant | User)[源代码]¶
返回participant(个人或组织)的名称
- Appointment.utils.identity.get_participant(user: User | str, update: bool = False, raise_except: Literal[False] = False) Participant | None [源代码]¶
- Appointment.utils.identity.get_participant(user: User | str, update: bool = False, raise_except: Literal[True] = False) Participant
通过User对象或学号获取对应的参与人对象
Args: - update: 获取带更新锁的对象 - raise_except: 失败时是否抛出异常,默认不抛出
Returns: - participant: 满足participant.Sid=user, 不存在时返回`None`
Raises: - DoesNotExist: 当`raise_except`为`True`时,如果不存在对应的参与人对象则抛出异常
- Appointment.utils.identity.identity_check(auth_func: ~typing.Callable[[~Appointment.models.Participant | None], bool] = <function _authenticate>, redirect_field_name: str = 'origin', allow_create: bool = True) Callable[[Callable[[Concatenate[HttpRequest, P]], HttpResponse]], Callable[[Concatenate[HttpRequest, P]], HttpResponse]] [源代码]¶