1 from rest_framework.views import APIView
 2 
 3 
 4 class DeleteLinkDataJson(APIView):
 5 
 6     def post(self, request):
 7         # 获取ulr中的参数 ----request.path
 8         id = request.path.split('/')[-1]
 9         data = Link.objects.filter(id=id)
10         if data:
11             data.delete()
12             return JsonResponse(f"成功删除id为{id}的链接")
13         else:
14             return JsonResponse(f"没有对应的id--{id}")

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
猜你喜欢
  • 2021-12-24
  • 2022-02-08
  • 2022-03-10
  • 2022-01-16
  • 2021-11-26
  • 2022-01-03
  • 2021-10-12
相关资源
相似解决方案