DjangoRestMultipleModels
DjangoRestMultipleModels copied to clipboard
Is it possible to send context with the querylist?
Actually i want to send extra argument with the serializer. Eg. serializer = PollDetailSerializer(context={"user_id": request.user.user_id})
@asbin143
I too had this requirement using this package. There is a way to override the get_serializer_context method just like this
def get_serializer_context(self):
context = super(CLASS_VIEWSET_NAME, self).get_serializer_context()
context.update({"user_id": self.request.user.user_id})
return context