override - django rest framework - adding to views.obtain_auth_token -
i have implemented token authentication django rest framework , can post username , password /api-token-auth/
, token.
url(r'^api-token-auth/', token_views.obtain_auth_token)
in addition token, want user
object related returned token.
how can override/add view , return actual user object?
you can find relevant view here:
assuming you've created sort of user serializer already, can take user
instance there , shove userserializer. add response, below.
... user_serializer = userserializer(user) return response({'token': token.key, 'user': user_serializer.data})
Comments
Post a Comment