📅  最后修改于: 2022-03-11 14:47:07.926000             🧑  作者: Mango
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):
...