users[t['userid']]['is_admin'] = t['is_admin']
users[t['userid']]['roles'] = [t['rolename']]
- return render_template('admin_users.html', users=users)
+ return render_template('admin_users.html', users=users.values())
@app.route('/admin/users/add', methods=['GET', 'POST'])
def admin_user_add():
vote = query_db('select * from votes where id=?', [idvote], one=True)
if user is None and not vote.is_public:
return False
- return True # :TODO:maethor:20120529: Check others things
+ return True # :TODO:maethor:120529: Check others things
def can_vote(idvote, iduser=-1):
if not can_see_vote(idvote, iduser):
return False
- return True # :TODO:maethor:20120529: Check others things
+ return True # :TODO:maethor:120529: Check others things
@app.route('/vote/<idvote>')
def vote(idvote):
[request.form['title'], request.form['description'], request.form['category'], date_begin, date_end, transparent, public, multiplechoice, role['id'], session['user']['id']])
g.db.commit()
vote = query_db('select * from votes where title = ? and date_begin = ? order by id desc',
- [request.form['title'], date_begin], one=True) # :DEBUG:maethor:20120528: Bug possible car le titre n'est pas unique
+ [request.form['title'], date_begin], one=True) # :DEBUG:maethor:120528: Bug possible car le titre n'est pas unique
if vote is None:
flash(u'Une erreur est survenue !', 'error')
return redirect(url_for('home'))
if 'public' in request.form.keys():
public = 1
isopen = 0
- if request.form['status'] == 'Ouvert': # :TODO:maethor:20120529: Check if there is at least 2 choices before
+ if request.form['status'] == 'Ouvert': # :TODO:maethor:120529: Check if there is at least 2 choices before
isopen = 1
g.db.execute('update votes set title = ?, description = ?, category = ?, is_transparent = ?, is_public = ?, is_open = ? where id = ?',
[request.form['title'], request.form['description'], request.form['category'], transparent, public, isopen, voteid])
else:
flash(u'Vous devez spécifier un titre.', 'error')
- # :TODO:maethor:20120529: Calculer la durée du vote (différence date_end - date_begin)
+ # :TODO:maethor:120529: Calculer la durée du vote (différence date_end - date_begin)
vote['duration'] = 15
group = query_db('select name from roles where id = ?', [vote['id_role']], one=True)
choices = query_db('select * from choices where id_vote = ?', [voteid])
if request.method == 'POST':
g.db.execute('update choices set name=? where id = ? and id_vote = ?', [request.form['title'], choiceid, voteid])
g.db.commit()
- elif request.method == 'DELETE': # :COMMENT:maethor:20120528: I can't find how to use it from template
+ elif request.method == 'DELETE': # :COMMENT:maethor:120528: I can't find how to use it from template
g.db.execute('delete from choices where id = ? and id_vote = ?', [choiceid, voteid])
g.db.commt()
return redirect(url_for('admin_vote_edit', voteid=voteid))