aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--famille.py6
-rw-r--r--templates/user/edit.html4
2 files changed, 4 insertions, 6 deletions
diff --git a/famille.py b/famille.py
index 1ad2465..88238fe 100644
--- a/famille.py
+++ b/famille.py
@@ -93,8 +93,6 @@ def get_db():
db = getattr(g, 'sqlite_db', None)
if db is None:
db = g.sqlite_db = connect_db()
- if getattr(g, 'timezone', None) is None:
- g.timezone = pytz.common_timezones
return db
@app.teardown_appcontext
@@ -255,7 +253,7 @@ def edit_user():
user = query_db('SELECT * FROM users WHERE id= ?',
(session['user_id'],), True)
user = {k: user[k] for k in user.keys() if user[k]}
- return render_template("user/edit.html", user=user)
+ return render_template("user/edit.html", user=user, timezones=pytz.common_timezones)
elif request.method == 'POST':
result = {}
try:
@@ -266,7 +264,7 @@ def edit_user():
else:
error = "Les deux mots de passe ne coïncident pas"
return render_template("user/edit.html", user=request.form,
- error=error)
+ timezones=pytz.common_timezones)
except KeyError:
pass
args = tuple(request.form[key] for key in
diff --git a/templates/user/edit.html b/templates/user/edit.html
index 2fc6c64..95b0323 100644
--- a/templates/user/edit.html
+++ b/templates/user/edit.html
@@ -81,8 +81,8 @@
<div class="col-md-4">
<select id="timezone" class="form-control"
name="timezone">
- {% for timezone in g.timezone %}
- <option {%if timezone==session.timezone %}selected="selected" {% endif %}>{{timezone}}</option>
+ {% for tz in timezones%}
+ <option {%if tz==session.timezone %}selected="selected" {% endif %}>{{tz}}</option>
{% endfor %}
</select>
</div>