1
myyou 2017-12-15 11:34:50 +08:00
django rest framework 有类似 flask 写法,也可以通过在 View 类定义请求方法来限制
|
2
celerysoft 2017-12-15 11:38:46 +08:00
|
3
manzhiyong 2017-12-15 11:41:40 +08:00
你不在 view 里写 post 接收方法不就完了
|
4
vZexc0m 2017-12-15 13:16:25 +08:00
|
5
iiduce 2017-12-15 13:22:19 +08:00
|
6
Nick2VIPUser 2017-12-15 14:36:15 +08:00
```
class TestView(View): def get(self, request): ...... def post(self, request): ...... ``` |
7
ZnZt 2017-12-15 20:43:46 +08:00
from django.views.decorators.http import require_POST, require_GET
@require_GET def query(): pass @require_POST def add(): pass |