Ejemplo n.º 1
0
def add_task():
    form = TasksForm()
    if form.validate_on_submit():
        task = Tasks(
            form.taskname.data,
            form.task.data,
            form.roles.data,
            form.parallel.data,
            form.sendmail.data,
        )
        db.session.add(task)
        db.session.commit()
        return redirect(url_for('tasks'))
    tasks = Tasks.query.order_by(db.desc(Tasks.taskname))
    return render_template('tasks/add_task.html', tasks=tasks, form=form)
Ejemplo n.º 2
0
def add_server():
    form = AddServerForm()
    if form.validate_on_submit():
        server = Server(
            form.name.data,
            form.description.data,
            form.match.data,
            form.ip.data,
            form.url.data,
            form.enabled.data,
        )
        db.session.add(server)
        db.session.commit()
        return redirect(url_for('servers'))
    server = Server.query.order_by(db.desc(Server.name))
    return render_template('servers/add_server.html', server=server, form=form)