Quiero lanzar un int que se pasa a la plantilla a través de la url, pero dice que la función str
no está definida.lanzando ints a str en Jinja2
¿Cómo puedo evitar esto?
Aquí está mi código:
{% extends "base.html" %}
{% block content %}
{% for post in posts %}
{% set year = post.date.year %}
{% set month = post.date.month %}
{% set day = post.date.day %}
{% set p = str(year) + '/' + str(month) + '/' + str(day) + '/' + post.slug %}
<h3>
<a href="{{ url_for('get_post', ID=p) }}">
{{ post.title }}
</a>
</h3>
<p>{{ post.content }}</p>
{% else: %}
There's nothing here, move along.
{% endfor %}
{% endblock %}
Esto me dejó sin palabras. Jinja2 se vuelve más y más increíble a medida que trabajo con él. – vectorfrog