Make datetime
customizable across templates
This commit is contained in:
parent
91a8ac9189
commit
3d1a130584
|
@ -183,8 +183,11 @@ def create_app(config=None):
|
||||||
g.assets = dict(css=['main.css'], js=['main.js'])
|
g.assets = dict(css=['main.css'], js=['main.js'])
|
||||||
|
|
||||||
@app.template_filter('datetime')
|
@app.template_filter('datetime')
|
||||||
def _jinja2_filter_datetime(ts):
|
def _jinja2_filter_datetime(ts, fmt=None):
|
||||||
return time.strftime('%b %d, %Y %I:%M %p', time.localtime(ts))
|
return time.strftime(
|
||||||
|
fmt or app.config.get('DATETIME_FORMAT', '%b %d, %Y %I:%M %p'),
|
||||||
|
time.localtime(ts)
|
||||||
|
)
|
||||||
|
|
||||||
@app.template_filter('b64encode')
|
@app.template_filter('b64encode')
|
||||||
def _jinja2_filter_b64encode(s):
|
def _jinja2_filter_b64encode(s):
|
||||||
|
|
Loading…
Reference in a new issue