diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-07-01 12:55:19 -0400 |
---|---|---|
committer | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2019-07-02 10:44:48 -0400 |
commit | e3389d42758feef5dad48e0bbcd5a0a3f6af4206 (patch) | |
tree | 1976362f474f206bbabf096f211e5fdc3216471f /src/workflow/forms.py | |
parent | 939f90eabd3fd6ac17b0a1a0646962ead88d5e99 (diff) |
Refactor Workflow Manager
Refactors wf manager according to: https://jira.opnfv.org/browse/LAAS-31
Change-Id: I72b4b0b808bb77846f44787fdd146f1053c047b5
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/workflow/forms.py')
-rw-r--r-- | src/workflow/forms.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/workflow/forms.py b/src/workflow/forms.py index ee44ecd..a2746f9 100644 --- a/src/workflow/forms.py +++ b/src/workflow/forms.py @@ -15,6 +15,7 @@ from django.template.loader import render_to_string from django.forms.widgets import NumberInput import json +import urllib from account.models import Lab from account.models import UserProfile @@ -428,6 +429,24 @@ class ConfirmationForm(forms.Form): ) +def validate_step(value): + if value not in ["prev", "next", "current"]: + raise ValidationError(str(value) + " is not allowed") + + +def validate_step_form(value): + try: + urllib.parse.unquote_plus(value) + except Exception: + raise ValidationError("Value is not url encoded data") + + +class ManagerForm(forms.Form): + step = forms.CharField(widget=forms.widgets.HiddenInput, validators=[validate_step]) + step_form = forms.CharField(widget=forms.widgets.HiddenInput, validators=[validate_step_form]) + # other fields? + + class OPNFVSelectionForm(forms.Form): installer = forms.ModelChoiceField(queryset=Installer.objects.all(), required=True) scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=True) |