whatf
whatf

Reputation: 6458

using django filters in jinja2

I am developing an application on appengine, and want to use the awesome timesince django templatetag. Since I am using jinja2, I do not have the timesince filter available. How can I import it from django and use in jinja template.

I saw this question, but it does not serve the need.

Upvotes: 3

Views: 2330

Answers (1)

Acorn
Acorn

Reputation: 50497

The timesince function that the Django filter uses can be found here: https://github.com/django/django/blob/master/django/utils/timesince.py

Documentation on writing custom jinja filters can be found here: http://jinja.pocoo.org/docs/api/#custom-filters

Upvotes: 7

Related Questions