From: Parker Berberian Date: Fri, 21 Dec 2018 15:55:13 +0000 (-0500) Subject: Fixes creation of ssh access job X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=2f272e3878c99ca64eaed8ca7b5e1de85c792eb5;p=pharos-tools.git 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 --- 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)