3

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.

4

1 に答える 1

7

Django フィルタが使用するtimesince関数は、https ://github.com/django/django/blob/master/django/utils/timesince.py にあります。

カスタム jinja フィルターの作成に関するドキュメントは、http: //jinja.pocoo.org/docs/api/#custom-filtersにあります。

于 2012-09-26T19:27:32.477 に答える