The Python Oracle

djangorestframework serializer errors: {u'non_field_errors': [u'No input provided']}

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Orient Looping

--

Chapters
00:00 Djangorestframework Serializer Errors: {U'Non_field_errors': [U'No Input Provided']}
00:50 Accepted Answer Score 20
01:19 Thank you

--

Full question
https://stackoverflow.com/questions/2062...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #serialization #djangomodels #djangorestframework

#avk47



ACCEPTED ANSWER

Score 20


You're providing a person instance to be updated by the serializer, but no accompanying data to update that instance with.

If you want to deserialize some request data to update that instance with then you're missing the data argument, for example:

PersonSerializer(person, data=request.DATA, partial=True)

However it sounds like the endpoint you want doesn't actually expect to deal with any input data (it's just an empty PUT request you're making right?) In which case you don't want/need to be using a serializer at all.