Fixed try/catch in logout view

This commit is contained in:
mario 2015-11-23 22:52:59 +01:00
parent d9b8f3faf6
commit f3151ad5c0

View File

@ -1,5 +1,6 @@
from django.contrib.auth import login, logout
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import status
from rest_framework.views import APIView
@ -64,7 +65,7 @@ class LogoutView(APIView):
def post(self, request):
try:
request.user.auth_token.delete()
except:
except (AttributeError, ObjectDoesNotExist):
pass
logout(request)