[英]how to delete entity from google appengine using ids
I'm trying to get the post entity using ID but everytime I try to run this code I get an error 'NoneType' object has no attribute 'delete. 我正在尝试使用ID获取帖子实体,但是每次尝试运行此代码时,都会收到错误“ NoneType”对象没有属性“删除”的错误。 I've tried using every method and variation but no luck. 我尝试使用所有方法和变体,但没有运气。
post_id = self.request.get("post_id")
q = db.GqlQuery("SELECT * FROM Post WHERE ID='" + post_id + "'").get()
q.delete()
I've figured it out. 我知道了。
Here is what I did: 这是我所做的:
post = Post.get_by_id(int(post_id))
post.delete()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.