wsf_129 2010-10-09 23:49
浏览 191
已采纳

利用gae编写blog程序时,添加blog出问题。

作为初学者,跟着书本试着编写个blog程序,好不容易运行成功,试着添加blog时发现,保存好的blog 的title为保存时的内容,而content为none,而且index.html的代码中不能写汉字,要不然就是乱码。。。
各位大虾,再帮在下一把吧!不胜感激!

  • 写回答

4条回答 默认 最新

  • u010804832 2010-10-10 12:05
    关注

    [code="python"]
    def post(self):
    entry = Entry()
    entry.title = self.request.get('content') # 你把content放到title里了,content字段没有赋值,当然为空

    if users.get_current_user():
        entry.author = users.get_current_user()
    
    entry.put()
    self.redirect('/')
    

    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?