replaced serializer.object with serializer.validated_data

This commit is contained in:
Marc 2014-12-02 12:28:05 +01:00
parent 064d49fdef
commit 36c41c151f

View File

@ -31,7 +31,7 @@ class Login(GenericAPIView):
response_serializer = TokenSerializer response_serializer = TokenSerializer
def login(self): def login(self):
self.user = self.serializer.object['user'] self.user = self.serializer.validated_data['user']
self.token, created = self.token_model.objects.get_or_create( self.token, created = self.token_model.objects.get_or_create(
user=self.user) user=self.user)
if getattr(settings, 'REST_SESSION_LOGIN', True): if getattr(settings, 'REST_SESSION_LOGIN', True):