【发布时间】:2012-05-03 15:24:07
【问题描述】:
我一直在尝试运行这个查询:
my_post = db.GqlQuery("SELECT * FROM Post where __key__ = KEY('Post', 1)")
self.render("showpost.html", my_post = my_post)
我的模板showpost.html 看起来像这样:
<div class="post">
<h3 class="post-subject">{{ my_post.subject }}</h3>
<div class="post-content">{{ my_post.content }}</div>
</div
我没有得到id=1 的帖子的详细信息,而是得到一个空白页。尽管存在 id=1 的帖子,但我不确定如何确认 GQLquery 是否确实返回了某些内容。有没有办法检查?
尝试以下方法:
my_post = db.GqlQuery("SELECT * FROM Post where subject = 'hello_world')
self.render("showpost.html", my_post = my_post)
我遇到了同样的问题(空白页),即使有帖子的主题是hello_world
非常感谢
【问题讨论】:
标签: google-app-engine gql