摘要: urls.py: from django.urls import path, re_path from drf import views urlpatterns = [ path('render/', views.RenderView.as_view()), ] views.py: from res 阅读全文
posted @ 2021-01-20 22:31 Sch01aR# 阅读(116) 评论(0) 推荐(0) 编辑
摘要: urls.py: from django.urls import path, re_path from drf import views urlpatterns = [ path('view/', views.TestView.as_view({"get": "list"})), ] views.p 阅读全文
posted @ 2021-01-20 21:08 Sch01aR# 阅读(157) 评论(0) 推荐(0) 编辑
摘要: GenericAPIView: 源码: class GenericAPIView(views.APIView): queryset = None serializer_class = None lookup_field = 'pk' lookup_url_kwarg = None filter_ba 阅读全文
posted @ 2021-01-20 18:52 Sch01aR# 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 可以在 settings.py 中设置每页显示的数据数量 REST_FRAMEWORK = { "PAGE_SIZE": 2, # 每页显示 2 条内容 } views.py: from rest_framework import serializers from rest_framework.pa 阅读全文
posted @ 2021-01-20 15:57 Sch01aR# 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 可以在 settings.py 中设置每页的大小 REST_FRAMEWORK = { "PAGE_SIZE": 2, # 每页显示 2 条内容 } views.py: from rest_framework import serializers from rest_framework.pagina 阅读全文
posted @ 2021-01-20 15:40 Sch01aR# 阅读(76) 评论(0) 推荐(0) 编辑
摘要: settings.py 中设置每页的大小 REST_FRAMEWORK = { "PAGE_SIZE": 2, # 每页显示 2 条内容 } view.py: from rest_framework import serializers from rest_framework.pagination 阅读全文
posted @ 2021-01-20 00:20 Sch01aR# 阅读(117) 评论(0) 推荐(0) 编辑