def get_serializer_context(self):
    """
    default return is
    {
        'request': self.request,
        'format': self.format_kwarg,
        'view': self
    }
    """
    context = super(YourViewSet, self).get_serializer_context()
    # You can add what you want
    context['device_id'] = self.request.META.get('HTTP_DEVICEID', '')
    return context


I got some typo. you have to return context in get_serializer_context.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to