@method_decorator(csrf_protect)
def post(self, request):
    username = request.data['username']
    password = request.data['password']
    user = authenticate(username=username, password=password)
    if (user is None):
        return Response({'error': 'incorrect credentials'})
    login(request, user)
    return redirect('/auth/')
@method_decorator(csrf_protect)
def post(self, request):
    username = request.data['username']
    password = request.data['password']
    user = authenticate(username=username, password=password)
    if (user is None):
        return Response({'error': 'incorrect credentials'})
    login(request, user)
    return redirect('/auth/')