15👍
✅
translations
is a reverse relation on Skill
model hence Skill.transations
is a one-to-many relationship. In your serializer you defined it as one-to-one relationship which is why DRF cant find any of the attributes since they dont exist on the QuerySet
. To fix it you simply need to use many=True
:
class SkillSerializer(serializers.ModelSerializer):
translations = SkillTrSerializer(many=True)
Source:stackexchange.com