From 2f272e3878c99ca64eaed8ca7b5e1de85c792eb5 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Fri, 21 Dec 2018 10:55:13 -0500 Subject: Fixes creation of ssh access job Minor changes that allows the ssh job to be created. Django model creation can become very complex when you go beyond the model.object.create() method, and this just fixes the order of operations. Change-Id: I811f26149365067bdd15f2466f8ba9211c3ef901 Signed-off-by: Parker Berberian --- dashboard/src/api/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dashboard') diff --git a/dashboard/src/api/models.py b/dashboard/src/api/models.py index b6bd79f..cc25f82 100644 --- a/dashboard/src/api/models.py +++ b/dashboard/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) -- cgit 1.2.3-korg