📜  用户通过测试 django - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:07.926000             🧑  作者: Mango

代码示例1
from django.contrib.auth.decorators import user_passes_test

def email_check(user):
    return user.email.endswith('@example.com')

@user_passes_test(email_check)
def my_view(request):
    ...