]> git.lizzy.rs Git - cheatdb.git/blob - app/template_filters.py
Use git init/fetch instead of git clone
[cheatdb.git] / app / template_filters.py
1 from . import app
2 from urllib.parse import urlparse
3
4 @app.context_processor
5 def inject_debug():
6     return dict(debug=app.debug)
7
8 @app.template_filter()
9 def throw(err):
10         raise Exception(err)
11
12 @app.template_filter()
13 def domain(url):
14         return urlparse(url).netloc
15
16 @app.template_filter()
17 def date(value):
18     return value.strftime("%Y-%m-%d")
19
20 @app.template_filter()
21 def datetime(value):
22     return value.strftime("%Y-%m-%d %H:%M") + " UTC"