mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
Set serializer_class on ObtainAuthToken view
This commit is contained in:
parent
22569e8202
commit
d0126b7e31
|
@ -11,9 +11,10 @@ class ObtainAuthToken(APIView):
|
|||
permission_classes = ()
|
||||
parser_classes = (parsers.FormParser, parsers.MultiPartParser, parsers.JSONParser,)
|
||||
renderer_classes = (renderers.JSONRenderer,)
|
||||
serializer_class = AuthTokenSerializer
|
||||
|
||||
def post(self, request):
|
||||
serializer = AuthTokenSerializer(data=request.data)
|
||||
serializer = self.serializer_class(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
user = serializer.validated_data['user']
|
||||
token, created = Token.objects.get_or_create(user=user)
|
||||
|
|
Loading…
Reference in New Issue
Block a user