diff options
| -rw-r--r-- | famille.py | 7 | ||||
| -rw-r--r-- | templates/news/list.html | 2 |
2 files changed, 6 insertions, 3 deletions
@@ -10,6 +10,8 @@ from docutils.writers.html4css1 import Writer from datetime import datetime from bs4 import BeautifulSoup from flask_mail import Mail, Message +import locale +locale.setlocale(locale.LC_ALL, 'fr_FR') def rstify(string): w = Writer() @@ -30,9 +32,10 @@ def shortify(string): return string @app.template_filter('format_date') -def format_date(date_object, format=u"%a %d %b %Y à %Hh%M".encode("utf8")): +def format_date(date_object, format=u"%a %d %b %Y à %Hh%M"): if not date_object: return "" + format = format.encode("utf8") return date_object.strftime(format).decode("utf8") @app.template_filter('pluralize') @@ -97,7 +100,7 @@ def add_news(): emails = query_db("SELECT email from users where notify=1") emails = [email["email"] for email in emails] message = Message(request.form['title'], sender="news.horel@gmail.com") - message.html = content_cache + message.body = content_cache message.recipients = emails mail.send(message) diff --git a/templates/news/list.html b/templates/news/list.html index 2f273e1..99d1571 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -11,7 +11,7 @@ {% for user in users %} <tr> <td><a href="{{url_for('view_user', user_id=user.id)}}">{{user.user_name}}</a></td> - <td>{{user.last_seen|format_date}}</td> + <td>{{user.last_seen|format_date('%a %d %b à %Hh%M')}}</td> </tr> {% endfor %} </table> |
