summaryrefslogtreecommitdiffstats
path: root/dashboard/src/booking
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard/src/booking')
-rw-r--r--dashboard/src/booking/admin.py3
-rw-r--r--dashboard/src/booking/forms.py7
-rw-r--r--dashboard/src/booking/migrations/0002_auto_20171213_1506.py28
-rw-r--r--dashboard/src/booking/models.py7
-rw-r--r--dashboard/src/booking/views.py3
5 files changed, 43 insertions, 5 deletions
diff --git a/dashboard/src/booking/admin.py b/dashboard/src/booking/admin.py
index d883be1..51e1031 100644
--- a/dashboard/src/booking/admin.py
+++ b/dashboard/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/dashboard/src/booking/forms.py b/dashboard/src/booking/forms.py
index 2dbfacb..1f09c05 100644
--- a/dashboard/src/booking/forms.py
+++ b/dashboard/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/dashboard/src/booking/migrations/0002_auto_20171213_1506.py b/dashboard/src/booking/migrations/0002_auto_20171213_1506.py
new file mode 100644
index 0000000..3e0a5fa
--- /dev/null
+++ b/dashboard/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/dashboard/src/booking/models.py b/dashboard/src/booking/models.py
index 0b3fa3b..0bf5961 100644
--- a/dashboard/src/booking/models.py
+++ b/dashboard/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/dashboard/src/booking/views.py b/dashboard/src/booking/views.py
index 6fdca0e..da2fe11 100644
--- a/dashboard/src/booking/views.py
+++ b/dashboard/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)})