def team_new(): if request.method == "POST": team_name = request.form['name'] if not Team.get_team_by_name(team_name): Team.add_team(team_name) return redirect(url_for('teams_ctrl.teams')) flash('Team name already in use') return render_template("add_team_form.html", title="Add new team", mainmenu=mainmenu)
def add_team(): team_name = request.get_json() if not Team.get_team_by_name(team_name): team = Team.add_team(team_name) team_in_json = json.dumps(team.__dict__, ensure_ascii=False) return team_in_json return ""