I\'ve the following model:
class NoteCategory(models.Model):
title = models.CharField(max_length=100, unique=True)
def __unicode__(self):
re
When you want to serialize objects, you pass object as a first argument.
serializer = CommentSerializer(comment)
serializer.data
# {'email': u'leila@example.com', 'content': u'foo bar', 'created': datetime.datetime(2012, 8, 22, 16, 20, 9, 822774)}
But when you want to deserialize you pass the data with a data
kwarg.
serializer = CommentSerializer(data=data)
serializer.is_valid()
# True
serializer.validated_data
# {'content': 'foo bar', 'email': 'leila@example.com', 'created': datetime.datetime(2012, 08, 22, 16, 20, 09, 822243)}
So in your case you want to deserialize your post data, therefor you have to do:
serializer = PatientNoteSerializer(data=request.data)