from rest_framework.permissions import BasePermission
class SvipPermission(BasePermission):
# 不能访问的提示信息
message = "必须是Svip用户才能访问"
def has_permission(self, request, view):
if request.user.user_type != 3:
return False
return True
django-rest-framework中如何自定义一个权限类
猜你喜欢
转载自blog.csdn.net/weixin_42289273/article/details/115350837
今日推荐
周排行