summaryrefslogtreecommitdiffstats
path: root/dashboard/src/booking/forms.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2018-10-10 16:06:47 -0400
committerParker Berberian <pberberian@iol.unh.edu>2018-10-15 13:16:11 -0400
commit25275685e9a735e51fae8b1a936ba5733f6fb770 (patch)
treec3af41d1986c0812ca7ed059c16c7c7c7bd354cf /dashboard/src/booking/forms.py
parentf2e83b24260b018bb7cc30421eda6c9a8cebc309 (diff)
Lab as a Service 2.0
See changes here: https://wiki.opnfv.org/display/INF/Pharos+Laas Change-Id: I59ada5f98e70a28d7f8c14eab3239597e236ca26 Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu> Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'dashboard/src/booking/forms.py')
-rw-r--r--dashboard/src/booking/forms.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/dashboard/src/booking/forms.py b/dashboard/src/booking/forms.py
deleted file mode 100644
index 9d71b42..0000000
--- a/dashboard/src/booking/forms.py
+++ /dev/null
@@ -1,65 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 Max Breitenfeldt and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-
-import django.forms as forms
-
-from booking.models import Installer, Scenario, Opsys
-from datetime import datetime
-
-class BookingForm(forms.Form):
- fields = ['start', 'end', 'purpose', 'opsys', 'reset', 'installer', 'scenario']
-
- start = forms.DateTimeField()
- end = forms.DateTimeField()
- reset = forms.ChoiceField(choices = ((True, 'Yes'),(False, 'No')), label="Reset System", initial='False', required=False)
- purpose = forms.CharField(max_length=300)
- opsys = forms.ModelChoiceField(queryset=Opsys.objects.all(), required=False)
- opsys.label = "Operating System"
- installer = forms.ModelChoiceField(queryset=Installer.objects.all(), required=False)
- scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=False)
-
-class BookingEditForm(forms.Form):
- fields = ['start', 'end', 'purpose', 'opsys', 'reset', 'installer', 'scenario']
-
- start = forms.DateTimeField()
- end = forms.DateTimeField()
- purpose = forms.CharField(max_length=300)
- opsys = forms.ModelChoiceField(queryset=Opsys.objects.all(), required=False)
- installer = forms.ModelChoiceField(queryset=Installer.objects.all(), required=False)
- scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=False)
- reset = forms.ChoiceField(choices = ((True, 'Yes'),(False, 'No')), label="Reset System", initial='False', required=True)
-
-
- def __init__(self, *args, **kwargs ):
- cloned_kwargs = {}
- cloned_kwargs['purpose'] = kwargs.pop('purpose')
- cloned_kwargs['start'] = kwargs.pop('start')
- cloned_kwargs['end'] = kwargs.pop('end')
- if 'installer' in kwargs:
- cloned_kwargs['installer'] = kwargs.pop('installer')
- if 'scenario' in kwargs:
- cloned_kwargs['scenario'] = kwargs.pop('scenario')
- super(BookingEditForm, self).__init__( *args, **kwargs)
-
- self.fields['purpose'].initial = cloned_kwargs['purpose']
- self.fields['start'].initial = cloned_kwargs['start'].strftime('%m/%d/%Y %H:%M')
- self.fields['end'].initial = cloned_kwargs['end'].strftime('%m/%d/%Y %H:%M')
- try:
- self.fields['installer'].initial = cloned_kwargs['installer'].id
- except KeyError:
- pass
- except AttributeError:
- pass
- try:
- self.fields['scenario'].initial = cloned_kwargs['scenario'].id
- except KeyError:
- pass
- except AttributeError:
- pass