def teams_create(): form = TeamForm(request.form) if not form.validate(): return render_template("teams/new.html", form=form) tm = Team(form.name.data) tm.account_id = current_user.id db.session().add(tm) db.session().commit() #Luodaan liitostauluun paikat tiimille (Jäävät alussa "Free" asetukselle) team_id = tm.id mate1 = Teammate(team_id) mate1.role = 1 mate2 = Teammate(team_id) mate2.role = 2 mate3 = Teammate(team_id) mate3.role = 3 mate4 = Teammate(team_id) mate4.role = 4 mate5 = Teammate(team_id) mate5.role = 5 db.session().add(mate1) db.session().add(mate2) db.session().add(mate3) db.session().add(mate4) db.session().add(mate5) db.session().commit() return redirect(url_for("teams_index"))
def teams_create(): form = TeamForm(request.form) if not form.validate(): return render_template("teams/new.html", form=form) t = Team(form.name.data) t.account_id = current_user.id db.session().add(t) db.session().commit() return redirect(url_for("teams_index"))
def teams_create(): form = TeamForm(request.form) if not form.validate(): return render_template("teams/list.html", teams=Team.find_users_teams(current_user.id), units=Team.units_in_teams(current_user.id), unit_numbers=Team.number_of_units_in_teams( current_user.id), form=form) t = Team(form.name.data) t.account_id = current_user.id db.session.add(t) db.session().commit() return redirect(url_for("teams_index"))