diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2018-11-19 15:56:29 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2018-11-19 15:56:29 -0500 |
| commit | f0aa25926ffffffcd1df6248b6179220a7c039a8 (patch) | |
| tree | 180ec6b9dd43701b71f1bbd389ca99495c561d9a | |
| parent | 468ebd25321c5eaec7e5d26eff86e62f237f18cb (diff) | |
| download | famille-flask-f0aa25926ffffffcd1df6248b6179220a7c039a8.tar.gz | |
fix timezones
| -rw-r--r-- | famille.py | 6 | ||||
| -rw-r--r-- | templates/user/edit.html | 4 |
2 files changed, 4 insertions, 6 deletions
@@ -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> |
