-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Description
This code:
serializer = ThingSerializer(data=things, many=True)
serializer.is_valid(raise_exception=True)
return Response(serializer.data, status=status.HTTP_200_OK)
yields:
{
"non_field_errors": [
"Expected a list of items but got type \"QuerySet\"."
]
}
whereas changing the is_valid
call to:
serializer.is_valid(raise_exception=False)
works without a problem. Removing that entire line yields:
When a serializer is passed a
data
keyword argument you must call.is_valid()
before attempting to access the serialized.data
representation.
You should either call.is_valid()
first, or access.initial_data
instead.
Metadata
Metadata
Assignees
Labels
No labels