From be0e74c1d15cab9855e59f7e170b478a9df34193 Mon Sep 17 00:00:00 2001 From: ira Date: Thu, 6 Jul 2017 10:42:37 +0700 Subject: [PATCH] Use request.data instead of trying to parse json --- authentication/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/authentication/views.py b/authentication/views.py index b916dfa..faba1eb 100644 --- a/authentication/views.py +++ b/authentication/views.py @@ -12,9 +12,8 @@ class LoginView(views.APIView): def post(self, request, format=None): - data = json.loads(request.body.decode('utf-8', errors='replace')) - username = data.get('username', None) - password = data.get('password', None) + username = request.data.get('username', None) + password = request.data.get('password', None) account = authenticate(username=username, password=password) if account is not None: if account.is_active: