This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
def validate(self, attrs):
view = self.context.get('view')
request = self._get_request()
if not view:
raise serializers.ValidationError(
_("View is not defined, pass it as a context variable")
)
is wrong, because in current version of DRF 3.11.2, get_serializer has changed its behavior
def get_serializer(self, *args, **kwargs):
"""
Return the serializer instance that should be used for validating and
deserializing input, and for serializing output.
"""
serializer_class = self.get_serializer_class()
kwargs.setdefault('context', self.get_serializer_context())
return serializer_class(*args, **kwargs)
If 'context' is already provided, as in LoginView.post, the new get_serializer does not override kwargs['context'] anymore, ending up not providing "view" in the context, so the api will fail.
I encountered a bug using your
SocialLoginView
because of a recent DRF update.As documented, I add a view called
FacebookLoginView
But I got the following response:
The exception point is here in serializer.py:
It seems that 'view' is not passed to context.
Then I find this in
LoginView
of views.pyThe line
is wrong, because in current version of DRF 3.11.2,
get_serializer
has changed its behaviorIf 'context' is already provided, as in
LoginView.post
, the newget_serializer
does not overridekwargs['context']
anymore, ending up not providing"view"
in the context, so the api will fail.