aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2018-12-21 10:55:13 -0500
committerParker Berberian <pberberian@iol.unh.edu>2018-12-21 10:55:13 -0500
commit023f4acbcf81e4354044951a48e6e0c06a2ca50b (patch)
treef7c78bffb10c9faa343cd859a66e0d3d3733c515
parentf344654fd14e972b1b443194201dfd4c19288809 (diff)
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 <pberberian@iol.unh.edu>
-rw-r--r--src/api/models.py6
1 files changed, 3 insertions, 3 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)