删除SKU表数据
接口分析
请求方式: Delte meiduo_admin/skus/(?P\d+)/
请求参数: 通过请求头传递jwt token数据。
在路径中携带删除的spu的id值
返回数据: JSON
返回空
后端实现
# SKUGoodsView继承的是ModelViewSet 所以删除逻辑还是使用同一个类视图
class SKUGoodsView(ModelViewSet):
serializer_class =SKUGoodsSerializer
pagination_class = PageNum
def get_queryset(self):
keyword=self.request.query_params.get('keyword')
if keyword == '':
return SKU.objects.all()
else:
return SKU.objects.filter(name=keyword)