aboutsummaryrefslogtreecommitdiffstats
path: root/src/booking
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2017-12-01 12:11:12 -0500
committerSawyer Bergeron <sbergeron@iol.unh.edu>2017-12-13 10:07:58 -0500
commiteb75879a4632015b427d97ab945eaaa0bc26959a (patch)
tree70bf5143ab1c2fc00272f304923d161be37f6b8e /src/booking
parent42763c659dd029cbe2c88e2292f638fd0735825e (diff)
Add Dashboard OS Selection Menu on Booking
JIRA: PHAROS-326 Implement dropdown menu on pod booking page for user to select base OS, as well as associated support in API and pod status/booking status views This patch includes the migration file mentioned by Parker Berbarian Change-Id: I46a7b0e5e7020a89bc8fa0fe53c10bbda14a2e2d Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/booking')
-rw-r--r--src/booking/admin.py3
-rw-r--r--src/booking/forms.py7
-rw-r--r--src/booking/migrations/0002_auto_20171213_1506.py28
-rw-r--r--src/booking/models.py7
-rw-r--r--src/booking/views.py3
5 files changed, 43 insertions, 5 deletions
diff --git a/src/booking/admin.py b/src/booking/admin.py
index d883be1..51e1031 100644
--- a/src/booking/admin.py
+++ b/src/booking/admin.py
@@ -13,5 +13,6 @@ from django.contrib import admin
from booking.models import *
admin.site.register(Booking)
+admin.site.register(Opsys)
admin.site.register(Installer)
-admin.site.register(Scenario) \ No newline at end of file
+admin.site.register(Scenario)
diff --git a/src/booking/forms.py b/src/booking/forms.py
index 2dbfacb..1f09c05 100644
--- a/src/booking/forms.py
+++ b/src/booking/forms.py
@@ -10,14 +10,15 @@
import django.forms as forms
-from booking.models import Installer, Scenario
+from booking.models import Installer, Scenario, Opsys
class BookingForm(forms.Form):
- fields = ['start', 'end', 'purpose', 'installer', 'scenario']
+ fields = ['start', 'end', 'purpose', 'opsys', '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) \ No newline at end of file
+ scenario = forms.ModelChoiceField(queryset=Scenario.objects.all(), required=False)
diff --git a/src/booking/migrations/0002_auto_20171213_1506.py b/src/booking/migrations/0002_auto_20171213_1506.py
new file mode 100644
index 0000000..3e0a5fa
--- /dev/null
+++ b/src/booking/migrations/0002_auto_20171213_1506.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10 on 2017-12-13 15:06
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('booking', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Opsys',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100)),
+ ],
+ ),
+ migrations.AddField(
+ model_name='booking',
+ name='opsys',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='booking.Opsys'),
+ ),
+ ]
diff --git a/src/booking/models.py b/src/booking/models.py
index 0b3fa3b..0bf5961 100644
--- a/src/booking/models.py
+++ b/src/booking/models.py
@@ -31,6 +31,12 @@ class Scenario(models.Model):
def __str__(self):
return self.name
+class Opsys(models.Model):
+ id = models.AutoField(primary_key=True)
+ name = models.CharField(max_length=100)
+
+ def __str__(self):
+ return self.name
class Booking(models.Model):
id = models.AutoField(primary_key=True)
@@ -41,6 +47,7 @@ class Booking(models.Model):
jira_issue_id = models.IntegerField(null=True)
jira_issue_status = models.CharField(max_length=50)
+ opsys = models.ForeignKey(Opsys, models.DO_NOTHING, null=True)
installer = models.ForeignKey(Installer, models.DO_NOTHING, null=True)
scenario = models.ForeignKey(Scenario, models.DO_NOTHING, null=True)
purpose = models.CharField(max_length=300, blank=False)
diff --git a/src/booking/views.py b/src/booking/views.py
index 6fdca0e..da2fe11 100644
--- a/src/booking/views.py
+++ b/src/booking/views.py
@@ -70,6 +70,7 @@ class BookingFormView(FormView):
booking = Booking(start=form.cleaned_data['start'],
end=form.cleaned_data['end'],
purpose=form.cleaned_data['purpose'],
+ opsys=form.cleaned_data['opsys'],
installer=form.cleaned_data['installer'],
scenario=form.cleaned_data['scenario'],
resource=self.resource, user=user)
@@ -117,6 +118,6 @@ class ResourceBookingsJSON(View):
def get(self, request, *args, **kwargs):
resource = get_object_or_404(Resource, id=self.kwargs['resource_id'])
bookings = resource.booking_set.get_queryset().values('id', 'start', 'end', 'purpose',
- 'jira_issue_status',
+ 'jira_issue_status', 'opsys__name',
'installer__name', 'scenario__name')
return JsonResponse({'bookings': list(bookings)})