diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2013-04-15 00:29:18 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2013-04-15 00:29:18 +0200 |
commit | 9fb5ed666cf428ae24ddcb1d5a306660526162be (patch) | |
tree | e11c6381ab21cf0d63b0af73102209d532de7a28 /app/views/__init__.py | |
parent | 18f0c3c367a4dd53aff163f717bb62fb661e8600 (diff) | |
download | kosten-9fb5ed666cf428ae24ddcb1d5a306660526162be.tar.gz kosten-9fb5ed666cf428ae24ddcb1d5a306660526162be.tar.bz2 kosten-9fb5ed666cf428ae24ddcb1d5a306660526162be.zip |
Moved the 'date' filter to the top-level
Diffstat (limited to '')
-rw-r--r-- | app/views/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/views/__init__.py b/app/views/__init__.py index eed6d0a..d64b945 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -20,6 +20,13 @@ def static_url(s): def eur(s): return (u"%s EUR" % s) +@app.template_filter("date") +def format_date(s, format="%Y/%m"): + if hasattr(s, "date"): + return s.date.strftime(format) + else: + return s.strftime(format) + @app.errorhandler(404) def page_not_found (error): return render_template("404.jinja", page = request.path), 404 |