Hi,
I have a jinja2 template (below) which has custom filters (e.g. currency).
When the page renders the filter doesn't change the text. I know the filter
works because I use it on other pages. I'm using this page as an ajax
response page.
Why is the filter not working?
{% if transactions %}
<table table id = 'tablesorter' class="table table-condensed table-hover
tablesorter">
</div>
<thead>
<tr>
<th>p</th>
<th>M</th>
<th>T</th>
<th class="right_align">A</th>
</tr>
</thead>
<tbody>
<tr>
{% for transaction in transactions %}
<td >{{ transaction.p}}</td>
<td>{{ transaction.m}}</td>
<td>{{ transaction.t}}</td>
<td class="currency right_align">{{ transaction.a|currency}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div></div>
{% endif %}
--------------
--filter
--------------
@app.template_filter('currency')
def currency_filter(value):
try:
return "${:,.2f}".format(value)
except:
return value
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pocoo-libs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.