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_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_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) 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(): 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"))