Updated URL Logic for admin package

This commit is contained in:
Patrick Jentsch
2019-11-15 11:45:04 +01:00
parent 74324ac0be
commit f22bff4ed0
13 changed files with 402 additions and 414 deletions

View File

@ -2,10 +2,10 @@ from app.models import Job, JobInput, JobResult
from flask import (abort, current_app, flash, redirect, render_template,
send_from_directory, url_for)
from flask_login import current_user, login_required
from threading import Thread
from . import jobs
from .background_functions import delete_job_
import os
import threading
@jobs.route('/<int:job_id>')
@ -23,10 +23,9 @@ def delete_job(job_id):
job = Job.query.get_or_404(job_id)
if not (job.creator == current_user or current_user.is_administrator()):
abort(403)
delete_thread = threading.Thread(target=delete_job_,
args=(current_app._get_current_object(),
job_id))
delete_thread.start()
thread = Thread(target=delete_job_,
args=(current_app._get_current_object(), job_id))
thread.start()
flash('Job has been deleted!')
return redirect(url_for('main.dashboard'))