Why jinja gives the elements of the list with quotes??

Good afternoon.

Give to the jinja template of objcet generator containing a list of this type:
('Super post', 'helo gelo everybody', ['tag', 'tag2'])

Start this business to iterate in the template
{% for poster in post %}
 <div class="blo">
 <h1>{{ poster[0] }}</h1>{{ poster[1] }}
 <div class="sashacom">
 {% for item in poster[2] %}
 {% if item != poster[2][-1]%}
 <a href="{{ url_for('tag', tag = 'item') }} "><b>{{ item }}</b></a>,
 {% else %}
 <a href="{{ url_for('tag', tag = 'item') }} "><b>{{ item }}</b></a>
 {% endif %}
 {% endfor %}
</div>
</div>
 {% endfor %}


Zero and the first element are displayed normally, the list items are displayed with quotes!!

Pass in the template:
@app.route('/index/<int:page>', methods=['GET'])
def index(page):
 paginate = Pagination(page)
 return render_template('index.html',
paginate=paginate,
 title = 'Simple blog on Flask',
 post = posts.get_posts_index(page),
 tag = posts.get_tags_index())</int:page>


Pass the parameter via Post.
Function:
def get_posts_index(PAGE):
 for posts in p.query.order_by(Post.timestamp.desc()).slice(start=POSTS_PER_PAGE*(PAGE-1),stop=POSTS_PER_PAGE*PAGE):
 yield (posts.title, posts.body, posts.tag)


Someone faced with similar? the brain already has vlobal yourself.
Thanks for the tip
September 19th 19 at 13:26
2 answers
September 19th 19 at 13:28
Likely posts.tag is a string, not a list.
Generally understood. changed def __repr__(self): return '%r' % (self.title) to '%s' in the model - Rogelio.Von commented on September 19th 19 at 13:31
September 19th 19 at 13:30
I had the problem that the list was perceived as a string, and was resolved only with the help [1:-1], and split(" ', ' ")

Find more questions by tags Jinja2PythonFlask