摘要: GenericAPIView # 基于GenericAPIViewfrom rest_framework.generics import GenericAPIView​​class BookAPIView(GenericAPIView): # 需要传入两个参数queryset,serializer_ 阅读全文
posted @ 2021-05-17 22:49 蚝油生菜 阅读(289) 评论(0) 推荐(0)
摘要: class BooksSerializers(serializers.ModelSerializer): class Meta: model = models.Books # 对应models.py中的模型 fields = '__all__' # 序列化所有字段 # filter = ('titl 阅读全文
posted @ 2021-05-17 20:57 蚝油生菜 阅读(53) 评论(0) 推荐(0)
摘要: #url.py​from django.contrib import adminfrom django.urls import path, re_pathfrom app_drf_books import views​urlpatterns = [ path('admin/', admin.site 阅读全文
posted @ 2021-05-17 16:44 蚝油生菜 阅读(226) 评论(0) 推荐(0)