本文整理汇总了Python中models.Message.customer_number方法的典型用法代码示例。如果您正苦于以下问题:Python Message.customer_number方法的具体用法?Python Message.customer_number怎么用?Python Message.customer_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Message
的用法示例。
在下文中一共展示了Message.customer_number方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import customer_number [as 别名]
def create(self):
new_message = Message()
new_message.customer_number = "1234567890"
new_message.product_code = str(random.randrange(100, 999))
new_message.shop_code = "123"
new_message.timestamp = datetime.now()
new_message.notified = False
return new_message
示例2: _parse_query
# 需要导入模块: from models import Message [as 别名]
# 或者: from models.Message import customer_number [as 别名]
def _parse_query(self, query_params):
shop_code = query_params.reply[:3]
product_code = query_params.reply[3:]
if not (Shop(shop_code).is_valid() and Product(product_code).is_valid()):
raise Exception('Invalid product or shop code.')
message = Message()
message.customer_number = query_params.cellno
message.product_code = product_code
message.shop_code = shop_code
message.timestamp = query_params.replydate #TODO: date conversion
return message