Simplify db lookup for queries by id

This commit is contained in:
Patrick Jentsch
2019-11-15 13:09:12 +01:00
parent 7457a4be94
commit 5fd9711da9
5 changed files with 14 additions and 8 deletions

View File

@ -3,7 +3,7 @@ from app.models import Job
def delete_job_(app, job_id):
with app.app_context():
job = Job.query.filter_by(id=job_id).first()
job = Job.query.get(job_id)
if job is None:
raise Exception('Job {} not found!'.format(job_id))
job.delete()