X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=main.py;h=8a99adbe8cd59952558dcb9c4c60af36cb451116;hb=0fb98decd67ec695937480b4d5448adbcd508565;hp=8c050b84625f08bca7ad7434a646f05fa44ec4e0;hpb=251888ac340c188dcf60da3120a752450663d63e;p=cavote.git diff --git a/main.py b/main.py index 8c050b8..8a99adb 100755 --- a/main.py +++ b/main.py @@ -29,7 +29,7 @@ def teardown_request(exception): @app.route('/') def home(): - return render_template('index.html') + return render_template('index.html', active_button="home") def query_db(query, args=(), one=False): cur = g.db.execute(query, args) @@ -206,15 +206,17 @@ def del_role(idrole): @app.route('/votes/') def show_votes(votes): today = date.today() + active_button = votes + basequery = 'select *, roles.name as rolename from votes join roles on roles.id=votes.id_role' if votes == 'all': - votes = query_db('select * from votes order by id desc') + votes = query_db(basequery + ' order by id desc') elif votes == 'archive': - votes = query_db('select * from votes where date_end < (?) order by id desc', [today]) + votes = query_db(basequery + ' where date_end < (?) order by id desc', [today]) elif votes == 'current': - votes = query_db('select * from votes where date_end >= (?) order by id desc', [today]) + votes = query_db(basequery + ' where date_end >= (?) order by id desc', [today]) else: abort(404) - return render_template('show_votes.html', votes=votes) + return render_template('show_votes.html', votes=votes, active_button=active_button) #------ # Vote