5
저는이 모든 것을 처음 접했고 태그로 간단한 블로그 게시물을 작성하는 방법을 알아 내려고했습니다. 다음은 관련 부분은 다음과 같습니다Flask/GAE에서 태그를 렌더링하는 방법은 무엇입니까?
모델 :
class Post(db.Model):
title = db.StringProperty(required = True)
content = db.TextProperty(required = True)
when = db.DateTimeProperty(auto_now_add = True)
author = db.UserProperty(required = True)
tags = db.ListProperty(db.Category)
WTForm :
class PostForm(wtf.Form):
title = wtf.TextField('Title', validators=[validators.Required()])
content = wtf.TextAreaField('Content', validators=[validators.Required()])
tags = wtf.TextField('Tags', validators=[validators.Required()])
템플릿 :
{% block content %}
<ul>
<h1 id="">List of Posts</h1>
{% for post in posts %}
<li>
{{ post.title } By {{ post.author.nickname() }})<br />
{{ post.content }}<br />
Author {{ post.author }} <br />
Tags {{ post.tags}} <br />
</li>
{% endfor %}
</ul>
{% endblock %}
문제는 그 내가 태그에 입력 상관없이 필드의 경우 템플릿 대신 태그 대신 빈 목록 (예 : '[]')이 렌더링됩니다. 이 문제를 해결할 수있는 힌트를 주셔서 감사합니다.