我有一个以Charfield为主键的跟踪模型:
tracking_code = models.CharField(max_length=255, primary_key=True)
我使用django REST框架构建了一个destroy API,如下所示:
class ShipmentPackAPIView(viewsets.GenericViewSet, generics.DestroyAPIView):
permission_classes = (permissions.IsAuthenticated, )
serializer_class = ShipmentPackUpdateSerializer
queryset = ShipmentPack.objects.all()
当我通过http DELETE方法删除一个跟踪代码时,值=“1.886729767250155854”:
curl -X "DELETE" http://localhost:8000/tracking_code/1.886729767250155854/
没找到!
但我用django模型查询它已被发现并且我通常删除了其他。
感谢您的帮助,感谢抱歉英语不好!