aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow
diff options
context:
space:
mode:
authorJustin Choquette <jchoquette@iol.unh.edu>2023-08-07 14:10:19 -0400
committerJustin Choquette <jchoquette@iol.unh.edu>2023-08-07 14:16:04 -0400
commita6168306c08e8d5b207b9acc48869180d194ff01 (patch)
tree51ffcafac4ae0b5fd4da363d9bf839e8ad3fc286 /src/workflow
parenta09db9f287a02873c0226759f8ea444bb304cd59 (diff)
User subsystem
Change-Id: Ibef4ede9b2d6a3ea465f79a9b5cbcc821afbccae Signed-off-by: Justin Choquette <jchoquette@iol.unh.edu>
Diffstat (limited to 'src/workflow')
-rw-r--r--src/workflow/README1
-rw-r--r--src/workflow/views.py11
2 files changed, 10 insertions, 2 deletions
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)