摘要: 1.基于BasePermission自定义权限 1.1 基于from rest_framework.permissions import BasePermission 实现权限 class App01Permission(BasePermission): def has_permission(sel 阅读全文
posted @ 2023-04-18 19:12 阿勒泰的鱼 阅读(42) 评论(0) 推荐(0)
摘要: 1. 基于DRF自己写认证类 1.1基于DRF的 BaseAuthentication 使用的基类:from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import A 阅读全文
posted @ 2023-04-18 17:04 阿勒泰的鱼 阅读(32) 评论(0) 推荐(0)
摘要: DRF提供了3个分页器,apiView和GenericView的用法是不一样的,具体使用方式如下, 1.PageNumberPagination 基于GenericAPIView实现的排序 class BOOKS2(GenericAPIView,ListModelMixin): queryset = 阅读全文
posted @ 2023-04-18 14:45 阿勒泰的鱼 阅读(95) 评论(0) 推荐(0)