标签:res views style 视图 api st3 http def 魔法
from rest_framework.viewsets import ViewSetMixin # 注意先后顺序,ViewSetMixin写在前面 class TestAll(ViewSetMixin,APIView): def test1(self,request):return HttpResponse(‘test‘) def test2(self, request): return HttpResponse(‘test2‘) def test3(self, request): return HttpResponse(‘test3‘)
url(r‘^test1/$‘, views.TestView.as_view({‘get‘: ‘test1‘})), url(r‘^test2/$‘, views.TestView.as_view({‘post‘: ‘test2‘})), url(r‘^test3/$‘, views.TestView.as_view({‘update‘: ‘test3‘})),
标签:res views style 视图 api st3 http def 魔法
原文地址:https://www.cnblogs.com/zhaijihai/p/10133720.html