I am sending axios.patch request with form-data in vue
axios.patch(`${API_BASE}/products/${id}/`, data, {
headers: { 'Content-Type': 'multipart/form-data'
}
and calling Django ModelViewset partial update
class MyViewSet(viewsets.ModelViewSet):
def update(self, request, *args, **kwargs):
data = request.data.copy()
question = self.get_object()
...
the problem is that I am getting all values in stringified form.. null values as 'null', integer values as '1', and so on. enter image description here
What should I do to get normal values(null as None, integer as int) in request.data?
solved this by setting null values as empty strings before the patch method and by setting allow_null=True in serializers