Ejemplo n.º 1
0
def new_task():
    form = AddTask(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        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 enrty was successfully added. Thanks.")
    else:
        flash_errors(form)
    return redirect(url_for('.tasks'))
Ejemplo n.º 2
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.º 3
0
def new_task():
    form = AddTask(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_task = FTasks(
                          form.name.data,
                          form.due_date.data,
                          form.priority.data,
                          form.posted_date.data,
                          '1',
                          '1'
                          )
        db.session.add(new_task)
        db.session.commit()
        flash('New entry was successfully posted. Thanks.')
    return redirect(url_for('tasks'))
Ejemplo n.º 4
0
def tasks():
    open_tasks = db.session.query(FTasks).filter_by(status='1').order_by(
        FTasks.due_date.asc())
    closed_tasks = db.session.query(FTasks).filter_by(status='0').order_by(
        FTasks.due_date.asc())
    return render_template('tasks/tasks.html', form=AddTask(request.form),
                           open_tasks=open_tasks, closed_tasks=closed_tasks)
Ejemplo n.º 5
0
def new_task():
    form = AddTask(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        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 enrty was successfully added. Thanks.")
    else:
        flash_errors(form)
    return redirect(url_for('.tasks'))
Ejemplo n.º 6
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.º 7
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.º 8
0
def add_task(list_id):
    if not current_user.is_authenticated:
        flash("You need to login or register to comment.")
        return redirect(url_for("home"))
    form = AddTask()
    if form.validate_on_submit():
        new_task = Tasks(
            task=form.task.data,
            status="NOT_COMPLETE",
            list_id=list_id,
            user_id=current_user.id,
            date=date.today().strftime("%B %d, %Y")
        )
        db.session.add(new_task)
        db.session.commit()
        return redirect(url_for("show_tasks", list_id=list_id))
    return render_template("add_task.html", form=form, current_user=current_user)
Ejemplo n.º 9
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'))
Ejemplo n.º 10
0
def new_task():
	print ( "new_task")
	form = AddTask(request.form, csrf_enabled=False)
	print (form.validate_on_submit())
	if form.validate_on_submit():
		print ("Form validated")
		new_task = FTasks(
			form.name.data,
			form.due_date.data,
			form.priority.data,
			form.posted_date.data,
			'1',
			'1')
		db.session.add(new_task)
		db.session.commit()
		flash('New entry was succssfully posted. Thanks')
	else:
		print ("Addition Failed")
		flash('Error entry not added.')
		print (form.errors)
	return redirect(url_for('tasks'))
Ejemplo n.º 11
0
def tasks():
	#g.db = connect_db()
	#cur = g.db.execute('SELECT NAME, DUE_DATE, PRIORITY, TASK_ID FROM FTASKS WHERE STATUS=1')
	#open_tasks= [dict(name=row[0], due_date=row[1],priority=row[2],task_id=row[3]) for row in cur.fetchall()]
	#cur = g.db.execute(' SELECT NAME , DUE_DATE, PRIORITY, TASK_ID FROM FTASKS WHERE STATUS=0')
	#closed_tasks = [dict(name = row[0], due_date=row[1],priority=row[2],task_id=row[3]) for row in cur.fetchall()]
	#g.db.close()
	#return render_template('tasks.html', open_tasks=open_tasks, closed_tasks=closed_tasks)
	open_tasks = db.session.query(FTasks).filter_by(status='1').order_by(FTasks.due_date.asc())

	closed_tasks = db.session.query(FTasks).filter_by(status='0').order_by(FTasks.due_date.asc())

	return render_template('tasks.html',form = AddTask(request.form), open_tasks=open_tasks, closed_tasks=closed_tasks)
Ejemplo n.º 12
0
def tasks():
    typ = User.query.filter_by(id=session['user_id']).first()
    approval_tasks = db.session.query(FTasks).filter_by(approval='0').order_by(
        FTasks.priority.desc())
    open_tasks = db.session.query(FTasks).filter_by(status='1').order_by(
        FTasks.priority.desc())
    closed_tasks = db.session.query(FTasks).filter_by(status='0').order_by(
        FTasks.priority.desc())
    return render_template('/tasks.html',
                           form=AddTask(request.form),
                           open_tasks=open_tasks,
                           closed_tasks=closed_tasks,
                           approval_tasks=approval_tasks,
                           typ=typ.typ)