Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Serializer
- class PinnedAppsSerizalazer(serializers.Serializer):
- app = serializers.ListField(
- child=serializers.CharField()
- )
- # View
- class PinnedAppView(APIView):
- def get(self, request):
- pinned_apps = ['a', 'b', 'c', 'd']
- serializer = PinnedAppsSerizalazer(pinned_apps, many=True)
- return Response(serializer.data)
- # Error
- Exception Type: AttributeError
- Exception Value:
- Got AttributeError when attempting to get a value for field `app` on serializer `PinnedAppsSerizalazer`.
- The serializer field might be named incorrectly and not match any attribute or key on the `str` instance.
- Original exception text was: 'str' object has no attribute 'app'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement