Beispiel #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'))
Beispiel #2
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'))
Beispiel #3
0
def register():
	error = None
	form = RegisterForm(request.form, csrf_enabled=False)
	if form.validate_on_submit():
		new_user = User(form.name.data,form.email.data,form.password.data,)
		try:
			db.session.add(new_user)
			db.session.commit()
			flash('Thanks for registering. Please login.')
			return redirect(url_for('.login'))
		except IntegrityError:
			error = 'Oh no! That username and/or email already exist.Please try again.'
	else:
		flash_errors(form)
	return render_template('/users/register.html', form=form, error=error)
Beispiel #4
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 entry was successfully added. Thanks.')
    else:
        flash_errors(form)
    return redirect(url_for('.tasks'))
Beispiel #5
0
def register():
    error = None
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User(
            form.name.data,
            form.email.data,
            form.password.data)
        try:
            db.session.add(new_user)
            db.session.commit()
            flash('Thanks for registering. Please login')
            return redirect(url_for('.login'))
        except IntegrityError:
            error = 'Username and/or email already exists.'
    else:
        flash_errors(form)
    return render_template('/users/register.html', form=form, error=error)
Beispiel #6
0
def register():
    error = None
    form = RegisterForm(request.form)
    if form.validate():
        new_user = User(
            form.name.data,
            form.email.data,
            form.password.data,
        )
        try:
            db.session.add(new_user)
            db.session.commit()
            flash('Thanks for registering. Please login.')
            return redirect(url_for('.login'))
        except IntegrityError:
            error = 'Oh no! That username and/or email already exist. Please try again.'
    else:
        if request.method == "POST":
            flash_errors(form)
    return render_template('/register.html', form=form, error=error)
Beispiel #7
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'))