Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 22, 2017. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sheer/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def current_date():
context = {'current_date': datetime.datetime.now()}
return context

@app.template_filter(name='possibles_to_list')
def possibles_to_list(possibles):
"""
This converts the output of 'possible_values_for' to a list, making it
possible to check if an item is in an aggregation, from within the
template.
"""
return [item['key'] for item in possibles]

@app.template_filter(name='date')
def date_filter(value, format="%Y-%m-%d"):
return date_formatter(value, format)
Expand Down