fix mistral dashbaord workflow execution form bug

fix a bug that when a workflow has no input params, execution form
will has a requried field with empty label

Close-bug:#1786723
Change-Id: I49b2125ef649e94e210ff5df739684626c175172
This commit is contained in:
privaterookie 2018-08-13 09:44:15 +08:00
parent 04c32537f7
commit 9f35dca96f

View File

@ -45,15 +45,16 @@ class ExecuteForm(forms.SelfHandlingForm):
for entry in list.split(","):
label, _, default = entry.partition("=")
label = label.strip()
self.workflow_parameters.append(label)
if default == "None":
default = None
required = False
else:
required = True
self.fields[label] = forms.CharField(label=label,
required=required,
initial=default)
if label != '':
self.workflow_parameters.append(label)
if default == "None":
default = None
required = False
else:
required = True
self.fields[label] = forms.CharField(label=label,
required=required,
initial=default)
def handle(self, request, data):
try: