Dango Rest Framework Tips

The request object will be passed only if DRF constructs the serializer for you, for example when you just pass the serializer_class to a ModelViewSet. But if you are using the Serializer in your custom views, please do remember to pass the request manually, otherwise it won’t work. item_serializer = ItemSerializer(item, context={“request”: request})

Written on May 1, 2019