"Expected A List Of Items But Got Type \"dict\"."

I am trying to build a api for updating first and last name for my user. I am getting the following error in HTTP Response

    "non_field_errors": [
        "Expected a list of items but got type \"dict\"."

I have written the following API and trying to pass the patch request to it.

class UserSelfUpdateView(UpdateAPIView):
    serializer_class = UserUpdateSerializer
    permission_classes = [UserPermissions, ]

    def update(self, request: Request, *args, **kwargs):
        instance = User.objects.filter(
        serializer = UserUpdateSerializer(instance,, many=True)

        return Response({'success': True}, status=status.HTTP_200_OK)

The serializer for the above request is:

class UserUpdateSerializer(serializers.ModelSerializer):

    class Meta:
        model = User
        fields: ('id', 'first_name', 'last_name')

The format in which I am trying to pass my request body is:

    "first_name": "A",
    "last_name": "B"

The reason for using

instance = User.objects.filter(

is because I want the functionality in a way that only logged in user is able to modify his details only.



The error is here

serializer = UserUpdateSerializer(instance,, many=True)

change to

serializer = UserUpdateSerializer(instance,

if passing many=True you need to pass a queryset not an instance