casting ints to str in Jinja2

前端 未结 3 2016
日久生厌
日久生厌 2020-12-29 02:44

I want to cast an int that\'s passed to the template through the url, but it says that the str function isn\'t defined.

How do I get around this?

<
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 03:34

    You may use join:

    {% set p = (year, month, day, post.slug)|join("/") %}
    

提交回复
热议问题