两个url 共用一个视图 url url(r'^books/$', views.BookViewSet.as_view({"get":"list","post":"create"}),name="book_list"), #{"get":"list","post":"create" } 当参数传递给.as_view 里面会经过一系列的判断处理 来处理请求 url(r'^books/(?P<pk>d+)$', views.BookViewSet.as_view({ 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy' }),name="book_detail"), view class BookViewSet(viewsets.ModelViewSet): queryset = Book.objects.all() serializer_class = BookSerializers