ListSerializer instances get error "TypeError: 'ListSerializer' object is not iterable". #9546
Unanswered
isaque-dantas
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The error message is:
TypeError: 'ListSerializer' object is not iterable
. It happens when getting the attributedata
from ConquestSerializer instances.Here is the main serializer:
`class EventSerializer(serializers.ModelSerializer):
class Meta:
model = Event
fields = ['user_who_created', 'name', 'year', 'edition_number', 'conquests']
The serializer where I get the error:
The CustomListSerializer class:
I just implemented Python's iterator protocol for when this class is passed through a for loop, and I think that it should be in the class
rest_framework.serializers.ListSerializer
.Beta Was this translation helpful? Give feedback.
All reactions