Auth: 王海飞
Data:2018-05-04
Email:779598160@qq.com
修改settings.py配置文件,增加分页的配置信息
结果:
注意:在结果在data对应的value值中,有一个count的key,表示返回数据有3条,next表示下一个的url,previous表示上一页的url。
修改settings.py配置文件,增加filter过滤的信息
pip install django-filter
配置DEFAULT_FILTER_BACKENDS
使用filter_class进行过滤筛选:
http://127.0.0.1:8080/stu/student/?name=王
不使用filter_class进行筛选:
使用filter_class进行过滤筛选:
http://127.0.0.1:8080/stu/student/?create_min=2018-02-01&create_max_max=2018-0-01
不使用filter_class进行筛选:
http://127.0.0.1:8080/stu/student/?status=LEAVE_SCH