X-Git-Url: http://git.cyclocoop.org/?p=cavote.git;a=blobdiff_plain;f=main.py;h=8c050b84625f08bca7ad7434a646f05fa44ec4e0;hp=bff42a018d94c9d87586a810251feed88a4d2e7f;hb=251888ac340c188dcf60da3120a752450663d63e;hpb=e39a423e56697a035ea099e1f0ab4af1917a5d9e diff --git a/main.py b/main.py index bff42a0..8c050b8 100755 --- a/main.py +++ b/main.py @@ -233,12 +233,13 @@ def can_vote(idvote, iduser=-1): @app.route('/vote/') def show_vote(idvote): - vote = query_db('select * from votes where id=?', [idvote], one=True) + vote = query_db('select *, roles.name as rolename from votes join roles on roles.id=votes.id_role where votes.id=?', [idvote], one=True) if vote is None: abort(404) if can_see_vote(idvote, session.get('user').get('id')): choices = query_db('select * from choices where id_vote=?', [idvote]) - return render_template('vote.html', vote=vote, choices=choices, can_vote=can_vote(idvote, session.get('user').get('id'))) + attachments = query_db('select * from attachments where id_vote=?', [idvote]) + return render_template('vote.html', vote=vote, attachments=attachments, choices=choices, can_vote=can_vote(idvote, session.get('user').get('id'))) flash('Vous n\'avez pas le droit de voir ce vote, désolé.') return(url_for('home'))