casting ints to str in Jinja2

Jinja2 also defines the ~ operator, which automatically converts arguments to string first, as an alternative to the + operator.

Example:

{% set p = year ~ "https://stackoverflow.com/" ~ month ~ "https://stackoverflow.com/" ~ day ~ "https://stackoverflow.com/" ~ post.slug %}

See Other operators or, if you really want to use str, modify the Environment.globals dictionary.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)