diff --git a/app/models.py b/app/models.py index a67c6975ac5d65402be2695f3486610f899f8360..2dc22a5e04df3b3d0417b62b8acccd383d4cad56 100644 --- a/app/models.py +++ b/app/models.py @@ -39,7 +39,7 @@ class Role(db.Model): # Relationships users = db.relationship('User', backref='role', lazy='dynamic') - def to_dict(self): + def to_dict(self, include_relationships=True): return {'id': self.id, 'default': self.default, 'name': self.name, @@ -423,6 +423,8 @@ class Job(db.Model): raise Exception('Could not restart job: status is not "complete/failed"') # noqa shutil.rmtree(os.path.join(self.path, 'output'), ignore_errors=True) shutil.rmtree(os.path.join(self.path, 'pyflow.data'), ignore_errors=True) # noqa + for result in self.results: + db.session.delete(result) self.end_date = None self.status = 'submitted'