本文整理汇总了Python中models.Message.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Message.delete方法的具体用法?Python Message.delete怎么用?Python Message.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Message
的用法示例。
在下文中一共展示了Message.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import delete [as 别名]
def post(self, message_key_url):
action = self.request.get('action')
if action == 'delete':
message = Message.get_message(message_key_url)
if message is not None:
if message.to_user.user_id() == users.get_current_user().user_id():
Message.delete(message_key_url)
self.redirect("/inbox")
else:
self.error(403)
else:
self.error(404)
示例2: test_model_message
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import delete [as 别名]
def test_model_message(self):
"""Test message"""
contact_type = ContactType(name='test')
contact_type.save()
contact = Contact(name='test', contact_type=contact_type)
contact.save()
self.user = DjangoUser(username=self.username, password='')
self.user.set_password(self.password)
self.user.save()
stream = MessageStream(name='test')
stream.save()
obj = Message(title='test', body='test', author=contact, stream=stream)
obj.save()
self.assertEquals('test', obj.title)
self.assertNotEquals(obj.id, None)
obj.delete()
示例3: delete_message
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import delete [as 别名]
def delete_message():
Comment.delete().where(
Comment.message_id == request.form['message_id']).execute()
Message.delete().where(Message.id == request.form['message_id']).execute()
return jsonify(True)