def get_admin_overview(request): token = str(request.GET.get('token', '')) if authenticate_token(token): if is_admin(token): user = AdminManager(token) return HttpResponse(json.dumps([user.overview()])) else: return HttpResponse(status=403) else: return HttpResponse(status=422)
def get_admin_project_menu(request): token = str(request.GET.get('token', '')) if authenticate_token(token): if is_admin(token): user = AdminManager(token) return HttpResponse(json.dumps([user.consumption_projects()])) else: return HttpResponse(status=403) else: return HttpResponse(status=422)
def get_admin_variation(request): start = str(request.GET.get('month', '')) token = str(request.GET.get('token', '')) if authenticate_token(token): if is_admin(token): user = AdminManager(token) return HttpResponse(json.dumps([user.variation(start)])) else: return HttpResponse(status=403) else: return HttpResponse(status=422)