From a6168306c08e8d5b207b9acc48869180d194ff01 Mon Sep 17 00:00:00 2001 From: Justin Choquette Date: Mon, 7 Aug 2023 14:10:19 -0400 Subject: User subsystem Change-Id: Ibef4ede9b2d6a3ea465f79a9b5cbcc821afbccae Signed-off-by: Justin Choquette --- src/workflow/README | 1 - src/workflow/views.py | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) delete mode 100644 src/workflow/README (limited to 'src/workflow') diff --git a/src/workflow/README b/src/workflow/README deleted file mode 100644 index 565d1c2..0000000 --- a/src/workflow/README +++ /dev/null @@ -1 +0,0 @@ -TODO: Document how new workflows work diff --git a/src/workflow/views.py b/src/workflow/views.py index 08ed22b..c634b38 100644 --- a/src/workflow/views.py +++ b/src/workflow/views.py @@ -8,12 +8,14 @@ ############################################################################## import json -from django.shortcuts import render +from django.shortcuts import render, redirect from laas_dashboard.settings import TEMPLATE_OVERRIDE from django.http import HttpResponse from django.http.response import JsonResponse from workflow.forms import BookingMetaForm from api.views import liblaas_request, make_booking +from api.utils import get_booking_prereqs_validator +from account.models import UserProfile def no_workflow(request): @@ -27,6 +29,9 @@ def design_a_pod_view(request): if request.method == "GET": if not request.user.is_authenticated: return login(request) + prereq_validator = get_booking_prereqs_validator(UserProfile.objects.get(user=request.user)) + if (prereq_validator["action"] == "no user"): + return redirect("dashboard:index") template = "workflow/design_a_pod.html" context = { "dashboard": str(TEMPLATE_OVERRIDE) @@ -43,10 +48,14 @@ def book_a_pod_view(request): if request.method == "GET": if not request.user.is_authenticated: return login(request) + prereq_validator = get_booking_prereqs_validator(UserProfile.objects.get(user=request.user)) + if (prereq_validator["action"] == "no user"): + return redirect("dashboard:index") template = "workflow/book_a_pod.html" context = { "dashboard": str(TEMPLATE_OVERRIDE), "form": BookingMetaForm(initial={}, user_initial=[], owner=request.user), + "prereq_validator": prereq_validator } return render(request, template, context) -- cgit 1.2.3-korg