From 5310da6a3c243ec1769b1cbde3acd42c53669f85 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Fri, 14 Dec 2018 10:31:34 -0500 Subject: Force Lab Selection on POD Creation Currently, a user can leave the "Define Hardware" step without choosing which lab thier pod should be at. This causes errors later in the pod creation process. This commit forces one lab to be selected before they can leave the first step. Change-Id: I7315bc8781ebeb66bcd32fdba30535100b59a3ff Signed-off-by: Parker Berberian --- src/workflow/resource_bundle_workflow.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/workflow/resource_bundle_workflow.py b/src/workflow/resource_bundle_workflow.py index 712c92b..11386f9 100644 --- a/src/workflow/resource_bundle_workflow.py +++ b/src/workflow/resource_bundle_workflow.py @@ -131,9 +131,12 @@ class Define_Hardware(WorkflowStep): try: self.form = HardwareDefinitionForm(request.POST) if self.form.is_valid(): - self.update_models(self.form.cleaned_data) - self.update_confirmation() - self.metastep.set_valid("Step Completed") + if len(json.loads(self.form.cleaned_data['filter_field']).labs) != 1: + self.metastep.set_invalid("Please select one lab") + else: + self.update_models(self.form.cleaned_data) + self.update_confirmation() + self.metastep.set_valid("Step Completed") else: self.metastep.set_invalid("Please complete the fields highlighted in red to continue") pass -- cgit 1.2.3-korg