aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/workflow/views.py')
-rw-r--r--src/workflow/views.py11
1 files changed, 10 insertions, 1 deletions
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)