diff options
Diffstat (limited to 'src/workflow')
-rw-r--r-- | src/workflow/README | 1 | ||||
-rw-r--r-- | src/workflow/views.py | 11 |
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) |