From 9fb5ed666cf428ae24ddcb1d5a306660526162be Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 15 Apr 2013 00:29:18 +0200 Subject: Moved the 'date' filter to the top-level --- app/views/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/views/__init__.py') 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 -- cgit v1.2.3-54-g00ecf