|
@@ -71,13 +71,13 @@ def logout():
|
|
|
|
|
|
@app.route('/votes/<votes>')
|
|
@app.route('/votes/<votes>')
|
|
def show_votes(votes):
|
|
def show_votes(votes):
|
|
- today = date.today().strftime('%d %B %Y')
|
|
|
|
|
|
+ today = date.today()
|
|
if votes == 'all':
|
|
if votes == 'all':
|
|
cur = g.db.execute('select title, description, date_begin, date_end from votes order by id desc')
|
|
cur = g.db.execute('select title, description, date_begin, date_end from votes order by id desc')
|
|
elif votes == 'archives':
|
|
elif votes == 'archives':
|
|
- cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end < :today order by id desc', {"today" : today})
|
|
|
|
|
|
+ cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end < (?) order by id desc', [today])
|
|
elif votes == 'currently':
|
|
elif votes == 'currently':
|
|
- cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end > :today order by id desc', {"today" : today})
|
|
|
|
|
|
+ cur = g.db.execute('select title, description, date_begin, date_end from votes where date_end >= (?) order by id desc', [today])
|
|
else:
|
|
else:
|
|
abort(404)
|
|
abort(404)
|
|
votes = [dict(title=row[0], description=row[1], date_begin=row[2], date_end=row[3],
|
|
votes = [dict(title=row[0], description=row[1], date_begin=row[2], date_end=row[3],
|
|
@@ -97,8 +97,8 @@ def new_vote():
|
|
def add_vote():
|
|
def add_vote():
|
|
if not session.get('logged_in'):
|
|
if not session.get('logged_in'):
|
|
abort(401)
|
|
abort(401)
|
|
- daten = date.today() + timedelta(days=int(request.form['days']))
|
|
|
|
- ndate = daten.strftime('%d %B %Y')
|
|
|
|
|
|
+ date_begin = date.today()
|
|
|
|
+ date_end = date.today() + timedelta(days=int(request.form['days']))
|
|
transparent = 0
|
|
transparent = 0
|
|
public = 0
|
|
public = 0
|
|
multiplechoice = 0
|
|
multiplechoice = 0
|
|
@@ -108,8 +108,8 @@ def add_vote():
|
|
public = 1
|
|
public = 1
|
|
if 'multiplechoice' in request.form.keys():
|
|
if 'multiplechoice' in request.form.keys():
|
|
multiplechoice = 1
|
|
multiplechoice = 1
|
|
- g.db.execute('insert into votes (title, description, date_end, is_transparent, is_public, is_multiplechoice) values (?, ?, ?, ?, ?, ?)',
|
|
|
|
- [request.form['title'], request.form['description'], ndate, transparent, public, multiplechoice])
|
|
|
|
|
|
+ g.db.execute('insert into votes (title, description, date_begin, date_end, is_transparent, is_public, is_multiplechoice) values (?, ?, ?, ?, ?, ?, ?)',
|
|
|
|
+ [request.form['title'], request.form['description'], date_begin, date_end, transparent, public, multiplechoice])
|
|
g.db.commit()
|
|
g.db.commit()
|
|
flash('New entry was successfully posted')
|
|
flash('New entry was successfully posted')
|
|
return redirect(url_for('home'))
|
|
return redirect(url_for('home'))
|