Discussion:
Deserializing JSON back to Django Model (File Error)
Johnson Kuang
2018-08-07 20:21:46 UTC
Permalink
I have a REST api that serializes a filefield. On the api, it displays the
absolute url of the file which works. Example: "pdf_file": "
https://makeabilitylab-test.cs.washington.edu/media/publications/Evaluating_Angular_Accuracy_of_Wrist-based_Haptic_Directional_Guidance_for_Hand_Movement_nIxCCJA.pdf
<http://makeabilitylab-test.cs.washington.edu/media/publications/Evaluating_Angular_Accuracy_of_Wrist-based_Haptic_Directional_Guidance_for_Hand_Movement_nIxCCJA.pdf>
.

However, when attempting to deserialize the JSON objects back into Django
model objects, it raises this error: {'pdf_file': [ErrorDetail(string='The
submitted data was not a file. Check the encoding type on the form.',
code='invalid')]}. What procedure do I have to go through to process these
urls back into the files that my filefield requires?
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...