django-rest-framework-bulk
django-rest-framework-bulk copied to clipboard
AttributeError: 'NoneType' object has no attribute 'request'
I've added BulkSerializerMixin to a view set (and set list_serializer_class to BulkListSerializer),
trying to PATCH a single object (which should not touch bulk operations at all), raises this error:
AttributeError: 'NoneType' object has no attribute 'request'
may be related to #39
using Django 1.10 with 3.4.6
I was doing POST and get the same error.
File "/usr/local/lib/python3.5/site-packages/rest_framework_bulk/drf3/serializers.py", line 19, in to_internal_value
request_method = getattr(getattr(self.context.get('view'), 'request'), 'method', '')
AttributeError: 'NoneType' object has no attribute 'request'
It looks like view is not pass to context.
I fixed this one via updating get_serializer_context method:
def get_serializer_context(self):
data = {}
data["view"] = self
return data