文档
测试

用户列表userList

GET
http://127.0.0.1:8000/userList

接口描述

获取用户列表,默认以id正序排列

请求参数

参数名
类型
描述
必填
ordering
char
排序方式,非必须。可选 'name', 'sex', 'created', 'updated', 'title', 'office', '-name', '-sex', '-created', '-updated', '-title', '-office'
必填
search
char
搜索字段,非必须。仅可搜索姓名
必填
sex
char
分类方式,非必须。可选 male 或 female
必填

说明 / 示例

## 排序方法: #### 可使用的参数 'name', 'sex', 'created', 'updated', 'title', 'office', '-name', '-sex', '-created', '-updated', '-title', '-office' #### 按照名称正序: http://127.0.0.1:8000/userList/?ordering=name #### 按照名称逆序: http://127.0.0.1:8000/userList/?ordering=-name ## 搜索方法: http://127.0.0.1:8000/userList/?search=XXX ## 过滤方法: 仅可过滤性别,即 male 或 female http://127.0.0.1:8000/userList/?sex=male http://127.0.0.1:8000/userList/?sex=female ## 综上 其实就是传入一个参数罢了。在json格式中 'ordering':'name' 之类的