-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for FileUploadParser with version 3.x #2399
Conversation
Output from parsers ends up in a Django MergeDict and they exists elements to be dicts - not None
Looks reasonable, but I'm uncertain why we havn't seen any issues raised before if this is currently broken - is it newly broken in 3.x? If not it'd be super surprising as |
Can't tell as i just started using the framework. Do note that i'm using the parser for a custom method on a viewset access request.data directly as per below. This gives an error because request.data is a mergedict where Maybe the serializers use another method for access FileUploadParser data?
|
Fix for FileUploadParser with 3.x
Output from parsers ends up in a Django MergeDict and they exists elements to be dicts - not None
Right now if FileUploadParser is used then trying to access request.data['file'] will give ** TypeError: 'NoneType' object has no attribute 'getitem'
Making sure that the data part is an empty dict fixes this