-
Notifications
You must be signed in to change notification settings - Fork 16
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
"Input is not a valid dict" when posting to a model with file attribute #21
Comments
Thanks for the PR! As mentioned in #20, do you have an example how to cause this error? For example, a |
Yes I was using a curl command like: |
Hi. This issue still exists - is there any update regarding this error? |
What I did to make it work was using Hope this helps someone. |
Really helpful @crstian . I had the same issue and solved quickly with your solution ! |
I have added the change that was done by @GuillaumeCisco but the code doesn't appear to work: ...
if isinstance(data, str):
# try to convert to json
try:
data = json.loads(data)
except:
self.fail('invalid_json_dump')
... |
You should overload TranslatedFieldsField and call the overloaded class in your serializer like this:
But It would be best if the error is fixed directly in the library |
Hello I've just detected that we get the error :
when posting with
requests.post
with afiles
attribute.the
file
attribute will force the request as a multipart formencoded, so the data will be json stringified.I've created a pull request for handling this behavior.
#20
The text was updated successfully, but these errors were encountered: