Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

@list_route post cannot return serializer(qs, many=True) #2918

Closed
@sainttail

Description

@sainttail

I have a@list_route that look like this

@list_route(methods=['post'])    def test(self, request):        queryset = self.filter_queryset(self.get_queryset())        serializer = self.get_serializer(queryset, many=True)        return Response(serializer.data)

but when I try to POST to .../events/test/ via browsable API
calling without browsable API is working normally.

I got exactly same error message as#2607 (ListSerializer object is not iterable)

I don't know why this happen? because I want post action to return update objects
However, if i change to this@list_route(methods=['get']) or@list_route(methods=['patch']) it is working fine

My serializer class is a normal class that extends form ModelSerializer

class EventSerializer(serializers.ModelSerializer):    class Meta:        model = Event

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp