File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ $ git clone https://github.com/HelloGitHub-Team/HelloDjango-REST-framework-tutor
193
193
4. [实现博客首页文章列表 API](https://www.zmrenwu.com/courses/django-rest-framework-tutorial/materials/93/)
194
194
5. [用类视图实现首页 API](https://www.zmrenwu.com/courses/django-rest-framework-tutorial/materials/94/)
195
195
6. [使用视图集简化代码](https://www.zmrenwu.com/courses/django-rest-framework-tutorial/materials/95/)
196
+ 7. [分页](https://www.zmrenwu.com/courses/django-rest-framework-tutorial/materials/96/)
196
197
197
198
# # 公众号
198
199
< p align=" center" >
Original file line number Diff line number Diff line change 135
135
# django-rest-framework
136
136
# ------------------------------------------------------------------------------
137
137
REST_FRAMEWORK = {
138
+ # 设置 DEFAULT_PAGINATION_CLASS 后,将全局启用分页,所有 List 接口的返回结果都会被分页。
139
+ # 如果想单独控制每个接口的分页情况,可不设置这个选项,而是在视图函数中进行配置
140
+ "DEFAULT_PAGINATION_CLASS" : "rest_framework.pagination.PageNumberPagination" ,
141
+ # 这个选项控制分页后每页的资源个数
138
142
"PAGE_SIZE" : 10 ,
139
143
}
You can’t perform that action at this time.
0 commit comments