Ejemplo n.º 1
0
def new_task():
    form = AddTask(request.form)
    if form.validate():
        new_task = FTasks(form.name.data, form.due_date.data,
                          form.priority.data, form.posted_date.data, '1',
                          session['user_id'])
        db.session.add(new_task)
        db.session.commit()
        flash('New entry was successfully posted. Thanks.')
    else:
        flash_errors(form)
    return redirect(url_for('.tasks'))
Ejemplo n.º 2
0
def new_task():
    print 'new task'
    form = AddTask(request.form, csrf_enabled=False)
    print form.errors
    print form.is_submitted()
    print form.errors
    if request.method == 'POST' and form.validate():
        print 'here'
        new_task = Ftasks(form.name.data, form.due_date.data, form.priority.data, form.posted_date.data, '1',
                          session['user_id'])
        db.session.add(new_task)
        db.session.commit()
        flash('New entry was successful!')
    else:
        flash_errors(form)
    return redirect(url_for('tasks'))
Ejemplo n.º 3
0
def new_task():
    form = AddTask(request.form)
    if form.validate():
        new_task = FTasks(
                    form.name.data,
                    form.due_date.data,
                    form.priority.data,
                    form.posted_date.data,
                    '1',
                    session['user_id']
                    )
        db.session.add(new_task)
        db.session.commit()
        flash('New entry was successfully posted. Thanks.')
    else:
        flash_errors(form)
    return redirect(url_for('.tasks'))
Ejemplo n.º 4
0
def new_task():
    form = AddTask(request.form)
    typ = User.query.filter_by(id=session['user_id']).first()
    approval = '0'
    status = '-1'

    if typ.typ == 'Manager':
        approval = '1'
        status = '1'

    if form.validate():
        new_task = FTasks(form.name.data, form.due_date.data,
                          form.priority.data, form.posted_date.data, status,
                          session['user_id'], approval)
        db.session.add(new_task)
        db.session.commit()
        flash('New entry was successfully posted. Thanks.')
    else:
        flash_errors(form)
    return redirect(url_for('.tasks'))