私はこのクエリを実行しようとしています:
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
どうもありがとう