本文整理汇总了Python中models.Message.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Message.get_by_id方法的具体用法?Python Message.get_by_id怎么用?Python Message.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Message
的用法示例。
在下文中一共展示了Message.get_by_id方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def post(self,sporocilo_id): # ce hocemo trajno zbrisat sporocilo: sporocilo.key.delete() in potem redirect
sporocilo = Message.get_by_id(int(sporocilo_id))
sporocilo.izbrisan = True
sporocilo.put()
self.redirect_to("seznam_sporocil")
示例2: post
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def post(self, message_id):
message = Message.get_by_id(int(message_id))
#message.ime= self.request.get("ime")
message.email = self.request.get("email")
message.content = self.request.get("sporocilo")
message.put()
self.redirect("/message/" + message_id)
示例3: get
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def get(self, message_id):
message = Message.get_by_id(int(message_id))
view_vars = {
"message": message,
}
return self.render_template("edit_message.html", view_vars)
示例4: message_delete
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def message_delete(pk=None):
""" delete message
:param pk:
:return:
"""
if request.method == 'DELETE':
msg = Message.get_by_id(pk)
msg.key.delete()
return jsonify({
pk: 'deleted'
}), 204
return jsonify({'errors': {}}), 400
示例5: sendReply
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def sendReply(user, msg_id, msg, msg_raw, subject, recipient_name, notify):
message = Message.get_by_id(int(msg_id))
new_message = {}
new_message['sender'] = user
new_message['subject'] = subject
new_message['sender_name'] = user.first_name + " " + user.last_name
new_message['sender_email'] = user.alias
new_message['receiver'] = message.sender
new_message['receiver_name'] = recipient_name
new_message['receiver_email'] = message.sender.email
new_message['content'] = msg_raw
new_message['type'] = 'reply_to'
new_message['category'] = message.sender.user_profile
new_message['date'] = strftime("%a, %d %b %Y %X +0000", gmtime())
result = outBoundMail(new_message)
msg = Message.create(new_message)
new_notify = sendCopy(new_message, notify)
user.notify_mail = notify
user.put()
print new_notify
print result
return msg
示例6: post
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def post(self, msg_id):
msg = Message.get_by_id(int(msg_id))
msg.key.delete()
return self.redirect_to("home")
示例7: get
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def get(self, msg_id):
msg = Message.get_by_id(int(msg_id))
params = {"msg": msg}
self.render_template("delete_msg.html", params)
示例8: message_get
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def message_get(pk=None):
msg = Message.get_by_id(pk)
return jsonify(msg.to_dict()), 200
示例9: get
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import get_by_id [as 别名]
def get(self,sporocilo_id):
sporocilo = Message.get_by_id(int(sporocilo_id))
params = {"sporocilo":sporocilo}
return self.render_template("izbrisi_sporocilo.html",params=params)