我想只更新Picture对象的一列
class PictureListViewer(APIView):
def patch(self, request, album_pk, format=None):
serializer = PictureSerializer(Picture.objects.all(), data = request.data, many = True, partial = True)
if serializer.is_valid(): #throws exception here
serializer.save()
return Response(status=status.HTTP_201_CREATED)
return Response(status=status.HTTP_400_BAD_REQUEST)
我在验证部分一直收到错误,好像序列化程序不喜欢QuerySet
'查询集'对象没有属性'专辑'
在PictureSerializer中,我定义了ListSerializer以及自定义update()方法