aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/models.py6
-rw-r--r--src/booking/migrations/0002_booking_pdf.py18
-rw-r--r--src/booking/models.py1
-rw-r--r--src/booking/views.py2
-rw-r--r--src/workflow/models.py6
5 files changed, 29 insertions, 4 deletions
diff --git a/src/api/models.py b/src/api/models.py
index b6bd79f..cc25f82 100644
--- a/src/api/models.py
+++ b/src/api/models.py
@@ -343,7 +343,7 @@ class AccessConfig(TaskConfig):
user = models.ForeignKey(User, on_delete=models.CASCADE)
revoke = models.BooleanField(default=False)
context = models.TextField(default="")
- delta = models.TextField()
+ delta = models.TextField(default="{}")
def to_dict(self):
d = {}
@@ -691,12 +691,12 @@ class JobFactory(object):
config = AccessConfig()
config.access_type = access_type
config.user = user
- if context:
- config.set_context(context)
config.save()
relation.config = config
relation.save()
config.clear_delta()
+ if context:
+ config.set_context(context)
config.set_access_type(access_type)
config.set_revoke(revoke)
config.set_user(user)
diff --git a/src/booking/migrations/0002_booking_pdf.py b/src/booking/migrations/0002_booking_pdf.py
new file mode 100644
index 0000000..53232c9
--- /dev/null
+++ b/src/booking/migrations/0002_booking_pdf.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1 on 2018-11-09 16:09
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('booking', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='booking',
+ name='pdf',
+ field=models.TextField(blank=True, default=''),
+ ),
+ ]
diff --git a/src/booking/models.py b/src/booking/models.py
index d0c77b4..74b766d 100644
--- a/src/booking/models.py
+++ b/src/booking/models.py
@@ -57,6 +57,7 @@ class Booking(models.Model):
config_bundle = models.ForeignKey(ConfigBundle, on_delete=models.SET_NULL, null=True)
project = models.CharField(max_length=100, default="", blank=True, null=True)
lab = models.ForeignKey(Lab, null=True, on_delete=models.SET_NULL)
+ pdf = models.TextField(blank=True, default="")
class Meta:
db_table = 'booking'
diff --git a/src/booking/views.py b/src/booking/views.py
index ab43519..29b53e2 100644
--- a/src/booking/views.py
+++ b/src/booking/views.py
@@ -112,7 +112,7 @@ def booking_detail_view(request, booking_id):
{
'title': 'Booking Details',
'booking': booking,
- 'pdf': ResourceManager().makePDF(booking.resource),
+ 'pdf': booking.pdf,
'user_id': user.id
})
diff --git a/src/workflow/models.py b/src/workflow/models.py
index bed6f52..73a142e 100644
--- a/src/workflow/models.py
+++ b/src/workflow/models.py
@@ -528,6 +528,12 @@ class Repository():
booking.collaborators.add(collaborator)
try:
+ booking.pdf = ResourceManager().makePDF(booking.resource)
+ booking.save()
+ except Exception as e:
+ return "BOOK, failed to create Pod Desriptor File: " + str(e)
+
+ try:
JobFactory.makeCompleteJob(booking)
except Exception as e:
return "BOOK, serializing for api generated exception: " + str(e) + " CODE:0xFFFF"