moving SQL statements to top of defs
This commit is contained in:
+6
-8
@@ -18,9 +18,8 @@ basic_auth = BasicAuth(app)
|
||||
|
||||
@routes.route('/convenor/clubList')
|
||||
def convenorListClub():
|
||||
sql = "SELECT club, team, league from _clubTeams ORDER BY club, team"
|
||||
rows = sql_read(sql)
|
||||
print(rows)
|
||||
clubTeam_lookup = "SELECT club, team, league from _clubTeams ORDER BY club, team"
|
||||
rows = sql_read(clubTeam_lookup)
|
||||
table = clubList(rows)
|
||||
table.border = True
|
||||
table.classes = ['table-striped', 'table-condensed', 'table-hover']
|
||||
@@ -34,22 +33,21 @@ def convenorAddClub():
|
||||
|
||||
@routes.route('/convenor/clubAddResult', methods=['POST'])
|
||||
def convenorAddClubResult():
|
||||
club_lookup = "SELECT club FROM _clubTeams WHERE club='" + _club + "' GROUP BY club"
|
||||
club_create = "INSERT INTO _clubTeams (club, team) VALUES ('" + _club + "', 'A')"
|
||||
try:
|
||||
_club = request.form['clubName']
|
||||
# validate that this data has been entered
|
||||
if _club and request.method == 'POST':
|
||||
sql = "SELECT club FROM _clubTeams WHERE club='" + _club + "' GROUP BY club"
|
||||
clubExist = sql_read(sql)
|
||||
clubExist = sql_read(club_lookup)
|
||||
if clubExist:
|
||||
return 'Club already exists - try adding a team instead'
|
||||
else:
|
||||
sql2 = "INSERT INTO _clubTeams (club, team) VALUES ('" + _club + "', 'A')"
|
||||
sql_write(sql2)
|
||||
sql_write(club_create)
|
||||
return render_template('_convenorClubAddResults.html', data=_club)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
@routes.route('/convenor/teamAdd')
|
||||
def convenorAddTeam():
|
||||
sql = "SELECT club FROM _clubTeams GROUP BY club ORDER BY club"
|
||||
|
||||
Reference in New Issue
Block a user