这是我的代码:
<form method="post" action="/del/" >
<input type="hidden" name="dealkey" value="{{deal.key()}}" />
<input class="btn btn-small" type="submit" value="Delete" />
</form>
class Delete(Handler):
def post(self):
dealid = self.request.get('dealkey')
dealid = int(dealid)
if dealid:
Book.delete(dealid)
self.redirect("/book")
app = webapp2.WSGIApplication([('/', MainPage),
('/book', BookMe),
('/del/',Delete),
],debug=True)
我正在尝试使用POST删除gae数据存储区中的实体,但是我得到405,有人可以解释一下吗?
答案 0 :(得分:1)
如何定义Handler
?
或者您可以使用内置处理程序并查看错误是否继续。
class Delete(webapp2.RequestHandler)
def post(self):
dealid = self.request.get('dealkey')
dealid = int(dealid)
if dealid:
Book.delete(dealid)
self.redirect("/book")