@method_decorator(ensure_csrf_cookie)
def get(self, request):
    if is_authenticated(request.user):
        username = request.user.username
    else:
        username = None
    return Response({'username': username})
@method_decorator(ensure_csrf_cookie)
def get(self, request):
    if is_authenticated(request.user):
        username = request.user.username
    else:
        username = None
    return Response({'username': username})