[Flask] commafy filter

Jani Šumak jani.sumak at gmail.com
Fri Apr 15 01:26:03 EDT 2016


Hi Gabor,

you mean something similar to intcomma in Django (
https://docs.djangoproject.com/en/1.9/ref/contrib/humanize/#intcomma)? I
think not (please correct me if I am wrong), but you can always register
your own filters. Take a look at custom filters
<http://jinja.pocoo.org/docs/dev/api/#custom-filters>.

Hope that helps!

Cheers, Jani

On Fri, Apr 15, 2016 at 7:06 AM Gabor Szabo <gabor at szabgab.com> wrote:

> Hi,
>
> is there a filter in Jinja to commafy numbers? That is, to put a comma
> in-front of ever 3 digits?
>
> I could not find one yet, so I've been using this expression all over the
> place:
>
> {{ "{:,}".format( value ) }}
>
> but I think it would be nicer if I could write
>
> {{ value | commafy }}
>
>
>
> regards
>   Gabor
>
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160415/e66dc6d4/attachment.html>


More information about the Flask mailing list