Mercurial > piecrust2
diff foodtruck/web.py @ 657:c1a94e1beb9d
admin: Show a more classic blog post listing in FoodTruck.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 25 Feb 2016 22:30:16 -0800 |
parents | 59968ee07a07 |
children | 65706804e1de |
line wrap: on
line diff
--- a/foodtruck/web.py Mon Feb 22 22:44:39 2016 -0800 +++ b/foodtruck/web.py Thu Feb 25 22:30:16 2016 -0800 @@ -1,5 +1,6 @@ import os import os.path +import time import logging from flask import Flask, g, request, render_template from .configuration import ( @@ -162,6 +163,18 @@ app.bcrypt = Bcrypt(app) +@app.template_filter('iso8601') +def timestamp_to_iso8601(t): + t = time.localtime(t) + return time.strftime('%Y-%m-%dT%H:%M:%SZ', t) + +@app.template_filter('datetime') +def timestamp_to_datetime(t, fmt=None): + fmt = fmt or '%x' + t = time.localtime(t) + return time.strftime(fmt, t) + + import foodtruck.views.create # NOQA import foodtruck.views.dashboard # NOQA import foodtruck.views.edit # NOQA