def editTeam(teamName): conn = sqlite3.connect("football.db") if request.method == "GET": cursor = conn.execute("SELECT * FROM TEAM WHERE TEAM_NAME=?", (teamName, )).fetchone() print(os.getcwd()) b = [ "teamName", "teamLogo", "squadPic", "founded", "homeGround", "teamCost", "teamWebsite", "teamOwner", "teamCoach", "teamSponsor", "country", "about" ] teamInfo = dict(zip(b, cursor)) conn.close() return render_template("teamEditForm.html", teamInfo=teamInfo) elif request.method == "POST": t = Team(teamName) about = request.form.get("teamAbout", None) if about.strip() == "": about = "This team is prominent team in league" t.insert_team(teamLogo=request.form.get("teamLogo", None), squadpic=request.form.get("squadPic", None), founded=request.form.get("founded", None), homeground=request.form.get("homeGround", None), teamcost=eval(request.form.get("teamCost", 0)), teamWebsite=request.form.get("teamWebsite", None), teamowner=request.form.get("teamOwner", None), teamcoach=request.form.get("teamCoach", None), sponser=request.form.get("teamSponsor", None), country=request.form.get("country", None), about=about, operation="update") flash("You Just Edited a Team " + teamName, "message") return redirect(url_for("showTeam"))
def editTeam(teamName): if request.method == "GET": a = db.info.find_one({"teamName": teamName}, { "players": 0, "_id": 0, "fixture": 0 }) return render_template("teamEditForm.html", teamInfo=a) elif request.method == "POST": t = Team(teamName) about = request.form.get("teamAbout", None) if about == "" or about == " ": about = "This team is prominent team in league" t.insert_team(teamLogo=request.form.get("teamLogo", None), squadpic=request.form.get("squadPic", None), founded=request.form.get("founded", None), homeground=request.form.get("homeGround", None), teamcost=eval(request.form.get("teamCost", 0)), teamWebsite=request.form.get("teamWebsite", None), teamowner=request.form.get("teamOwner", None), teamcoach=request.form.get("teamCoach", None), sponser=request.form.get("teamSponsor", None), country=request.form.get("country", None), about=about, operation="update") print(request.form) return redirect(url_for("showTeam"))
def addTeam(): if request.method == 'POST': t = Team(request.form["teamName"]) t.insert_team(teamLogo=request.form.get("teamLogo", None), squadpic=request.form.get("squadPic", None), founded=request.form.get("founded", None), homeground=request.form.get("homeGround", None), teamcost=eval(request.form.get("teamCost", 0)), teamWebsite=request.form.get("teamWebsite", None), teamowner=request.form.get("teamOwner", None), teamcoach=request.form.get("teamCoach", None), sponser=request.form.get("teamSponsor", None), country=request.form.get("country", None), operation="insert") return redirect(url_for("teamInfo")) else: return render_template("teamAddForm.html")
def addTeam(): if request.method == 'POST': about = request.form.get("teamAbout", None) if about == "" or about == " ": about = "This team is prominent team in league" t = Team(request.form.get("teamName", None)) t.insert_team(teamLogo=request.form.get("teamLogo", None), squadpic=request.form.get("squadPic", None), founded=request.form.get("founded", None), homeground=request.form.get("homeGround", None), teamcost=eval(request.form.get("teamCost", 0)), teamWebsite=request.form.get("teamWebsite", None), teamowner=request.form.get("teamOwner", None), teamcoach=request.form.get("teamCoach", None), sponser=request.form.get("teamSponsor", None), country=request.form.get("country", None), about=about, operation="insert") return redirect(url_for("showTeam")) else: return render_template("teamAddForm.html")