Merge pull request #111 from kseistrup/master
Make datetimes customizable
This commit is contained in:
commit
bca09fa8ba
|
@ -186,8 +186,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