def tasks_create(): form = TaskForm(request.form) if not form.validate(): return render_template("tasks/new.html", form = form) t = Task(form.name.data) t.done = form.done.data db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_operation(task_id): form = TaskOperationForm(request.form) t = Task.query.get(task_id) print(t.trip_id) if not form.validate(): print("ERROR: *TASK*OPERATIONFORM ERROR") print(form.data) print(form.errors) print(form.data) if form.data["operation"] == 'Muuta status': print(t.done) if t.done == True: Task.booleanToFalse_task(task_id) else: Task.booleanToTrue_task(task_id) db.session().commit() if form.data["operation"] == 'Poista': Task.delete_task(task_id) if form.data["operation"] == 'Muokkaa': Task.modify_task(task_id, form.data["name"]) db.session().commit() print("MUOKKAA") return redirect(url_for("trip_details", trip_id=t.trip_id))
def tasks_create(trip_id): form = TaskForm(request.form) if not form.validate(): return render_template("tasks/new.html", form=form, trip_id=trip_id) t = Task(form.name.data, trip_id) t.done = form.done.data t.account_id = current_user.id db.session().add(t) db.session().commit() return redirect(url_for("trip_details", trip_id=trip_id))
def tasks_create(): form = TaskForm(request.form) #if not form.validate(): # return render_template("tasks/new.html", form = form) t = Task(form.name.data) t.done = form.done.data t.account_id = current_user.id t.group_id = form.groups.data db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_create(): form = TaskForm(request.form) if not form.validate(): return render_template("tasks/new.html", form=form) task = Task(form.name.data, form.description.data, form.estimated_time.data) task.used_time = 0 task.account_id = current_user.id task.username = current_user.name db.session().add(task) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_index(): categories = Category.get_categories() tasks = Task.query.filter_by(account_id = current_user.id) if 'category' not in session: session['category'] = "all" if request.args.get('category'): session['category'] = request.args.get('category') category = session['category'] if category != "all": if category == "none": category = None tasks = tasks.filter_by(category_id=category) tasks = tasks.order_by(Task.done, asc(Task.deadline)).all() overdue = Task.count_overdue()[0] return render_template("tasks/index.html", tasks = tasks, categories = categories, overdue = overdue)
def tasks_create(): t = Task(request.form.get("name")) db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_create(): t = Task(request.form.get("name")) db.session().add(t) db.session().commit() return "hello world!"
def tasks_create(): form = TaskForm(request.form) form.tasks_and_categories.choices = [(category.id, category.name) for category in Category.query.all()] if not form.validate(): return render_template("tasks/new.html", form=form) t = Task(form.name.data, form.priority.data, Category.all_by_id(form.tasks_and_categories.data)) t.done = form.done.data t.account_id = current_user.id db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_create(project_id): project = Project.query.get(project_id) form = TaskForm(request.form) if not form.validate(): return render_template('tasks/new_task.html', form=form, project_id=project_id) new_task = Task(form.category.data, form.hours.data, form.description.data) new_task.project_id = project.id new_task.account_id = current_user.id current_user.tasks.append(new_task) project.tasks.append(new_task) db.session().add(new_task) db.session().add(current_user) db.session().add(project) db.session().commit() return redirect(url_for('tasks_index', project_id=project_id))
def create_tasks(): form = TaskForm(request.form) if not form.validate(): return render_template("tasks/create.html", form=form) t = Task(form.name.data, form.description.data, form.deadline.data) t.user_id = current_user.id labels = form.labels.data.split(",") for l in labels: t.labels.append(Label(l.strip())) db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_create(): form = TaskForm(request.form) if not form.validate(): return render_template("tasks/new.html", form = form) dl = form.deadline.data pa = form.possible_after.data t = Task(form.name.data, form.description.data, dl, pa) t.account_id = current_user.id if(form.category.data): t.category_id = form.category.data.id db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
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))
def new_task(): if request.method == "GET": return render_template("tasks/new.html") task = Task(request.form["title"], request.form["desc"], request.form["tests"]) db.session().add(task) db.session().commit() return redirect(url_for("index"))
def index(): if current_user.admin: return redirect(url_for("tasks_index")) new = current_user.get_new_tasks() inprogress = Task.show_tasksinprogress_by(current_user) recommendations = current_user.recommendations() return render_template("index.html", new=new, inprogress=inprogress, recommendations=recommendations)
def tasks_new(): form = TaskFormBase(request.form) # Just for the record, I have no idea what I'm doing here # This is apparently how you get a custom number of fields # But I have no idea how to make a new version of the same form in case of failure class TaskForm(TaskFormBase): pass classes = Class.query.filter_by(account_id=current_user.id).all() for c in classes: setattr(TaskForm, str(c.id), BooleanField(c.name)) # For some reason this doesn't copy errors new = TaskForm() new.name = form.name new.estimate = form.estimate # ...but this works anyhow if not new.validate(): return render_template("tasks/new.html", form=new) t = Task(new.name.data) t.account_id = current_user.id t.estimate = (new.estimate.data) # Checking which classes were selected for field in new: try: # If short_name is int, this does not throw error and it is a booleanfield describing a class with the id short_name c = Class.query.get(int(field.short_name)) if (field.data): t.classes.append(c) except ValueError: pass db.session().add(t) db.session().commit() return redirect(url_for("tasks_details", task_id=t.id))
def tasks_create(): lomake = TehtäväLomake(request.form) lomake.apu.choices = [(l.id, l.nimi) for l in Luokka.query.all()] if not lomake.validate(): return render_template("tasks/new.html", lomake = lomake) t = Task(lomake.nimi.data, Luokka.all_by_id(lomake.apu.data)) t.done = lomake.tehty.data t.urgent = lomake.kiireellisyys.data t.time = lomake.aikavaatimus.data t.kayttaja_id = current_user.id db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def tasks_details(task_id): t = Task.query.get(task_id) if t.account_id != current_user.id: return redirect(url_for("auth_unauthorized")) time = Task.get_total_time_spent_on_task(task_id) wps = WorkingPeriod.query.filter_by(task_id=task_id) return render_template("tasks/details.html", task=t, total_time=time, working_periods=wps)
def index(): if request.method == 'POST': print("post request recived") task_content = request.form['content'] new_task = Task(content=task_content) try: db.session.add(new_task) db.session.commit() return redirect('/tasks/') except: return 'There was an issue adding your task' else: tasks = Task.query.order_by(Task.date_created).all() return render_template('index.html', tasks=tasks)
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))
def auth_info(): form = UserForm(request.form) user = User.query.get(current_user.id) if not form.validate(): return render_template("auth/information.html", form=UserForm(), tasks=Task.find_users_tasks(current_user.id)) if form.name.data: user.name = form.name.data if form.username.data: if not User.unique_username(form.username.data): user.username = form.username.data if form.password.data: user.password = form.password.data db.session().commit() return redirect(url_for("auth_information"))
def tasks_create(): form = TaskForm(request.form) if not form.validate(): return render_template("tasks/new.html", form = form) t = Task(form.name.data) t.done = form.answer.data t.account_id = current_user.id apu = Subject.find_id_of_subject(form.subject.data) if apu != -999: t.subject_id = apu else: s = Subject(form.subject.data) db.session().add(s) db.session().commit() apu2 = Subject.find_id_of_subject(form.subject.data) t.subject_id = apu2 db.session().add(t) db.session().commit() return redirect(url_for("tasks_index"))
def example(content): exampleData = Task(content=content) db.session.add(exampleData) db.session.commit() return "created example task"
def subjects_id(subject_id): t = Task.find_questions_with_subject(subject_id) return render_template("subjects/all.html", tasks=t)
def statistics_index(): return render_template("statistics/list.html", undone_tasks=User.find_users_with_undone_tasks(), users_undone_tasks=Task.find_undone_tasks(), users_done_tasks=Task.find_done_tasks())
def tasks_archived(): return render_template( "tasks/archived.html", tasks=Task.query.filter_by(user_id=current_user.id).filter( Task.archived == True), count=Task.count_all_tasks(current_user.id))
def tasks_index(): return render_template("tasks/list.html", tasks=Task.query.filter_by(user_id=current_user.id), completed=Task.list_all_completed_tasks( current_user.id), count=Task.count_all_tasks(current_user.id))
def tasks_index(): return render_template("tasks/list.html", tasks=Task.query.filter_by(user_id=current_user.id), current_date=datetime.now(), count=Task.count_all_tasks(current_user.id))
def auth_information(): return render_template("auth/information.html", form=UserForm(), tasks=Task.find_users_tasks(current_user.id))
def index(): return render_template("index.html", needs_answers=Task.find_questions_with_no_answers())