其他分享
首页 > 其他分享> > 删除一个数据

删除一个数据

作者:互联网

class BookView(APIView):
    def delete(self,request,pk):
        ret=Book.objects.filter(pk=pk).delete()
        return Response({'status':100,'msg':'删除成功'})
# urls.py
re_path('books/(?P<pk>\d+)', views.BookView.as_view()),
```

  

标签:BookView,删除,一个,APIView,Book,pk,数据,delete
来源: https://www.cnblogs.com/dzs894330350/p/16104768.html