So I am using a basic API view as such:
@api_view(['GET'])
def load_info(request,user_id):
user = User.objects.get(pk=user_id)
profile = user.profile
serialized = ProfileSerializerInfo(profile,data=request.DATA)
print serialized.data
if serialized.is_valid():
return Response(serialized)
else:
return Response(serialized.errors)
now the print serialized.data returns the full amount of information with a user, yet the JSON returned is the serialized.errors, which says:
{
"user": [
"This field is required."
]
}
why is Django rest framework not noticing the user field in the JSON?
Note
this is what serialized.data looks like:
{'user': {u'id': 22, ...}, 'follower_count':3452,...}
I also tried passing serialized.data to Response, but that did not work either.
by request, here is the serializer:
class ProfileSerializerInfo(serializers.ModelSerializer):
user = UserSerializer()
class Meta:
model = Profile