@app.route('/vote/<idvote>')
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'))