Exemple #1
0
def tasks_index(project_id):
    return render_template(
        "tasks/list.html",
        tasks=Task.find_tasks_in_project(project_id),
        workdone=Project.work_done_in_project(project_id),
        workestimated=Project.work_estimated_in_project(project_id),
        project_id=project_id,
        form=TaskForm(),
        userworkdone=Project.work_done_in_project_by_user(project_id),
        userworkestimate=Project.work_estimated_in_project_by_user(project_id))
Exemple #2
0
def tasks_create():
    form = TaskForm(request.form)
    project_id = request.args.get('project_id')

    if not form.validate():
        return render_template(
            "tasks/list.html",
            tasks=Task.find_tasks_in_project(project_id),
            workdone=Project.work_done_in_project(project_id),
            project_id=project_id,
            form=form)

    t = Task(form.tasktype.data)
    t.description = form.description.data
    t.time = form.time.data
    t.taskstatus = form.taskstatus.data
    t.project_id = project_id
    t.account_id = current_user.id

    db.session().add(t)
    db.session().commit()

    return redirect(url_for('tasks_index', project_id=project_id))