本文整理匯總了Python中models.Customer.get_by_key_name方法的典型用法代碼示例。如果您正苦於以下問題:Python Customer.get_by_key_name方法的具體用法?Python Customer.get_by_key_name怎麽用?Python Customer.get_by_key_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Customer
的用法示例。
在下文中一共展示了Customer.get_by_key_name方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: post
# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import get_by_key_name [as 別名]
def post(self):
if not self.is_logged_in():
self.redirect(LOGIN_PAGE_URL)
else:
customer = Customer.get_by_key_name(self.get_current_username())
customer.first_name = self.get_argument('first_name')
customer.last_name = self.get_argument('last_name')
customer.timezone = self.get_argument('timezone')
landline_key = self.get_argument('landline_key')
landline = db.get(db.Key(landline_key))
landline.number = self.get_argument('landline_number')
mobile_key = self.get_argument('mobile_key')
mobile = db.get(db.Key(mobile_key))
mobile.number = self.get_argument('mobile_number')
location_key = self.get_argument('location_key')
location = db.get(db.Key(location_key))
location.city = self.get_argument('city')
location.country = self.get_argument('country')
location.state_or_province = self.get_argument('state_or_province')
location.area_or_suburb = self.get_argument('area_or_suburb')
location.street_name = self.get_argument('street_name')
location.zip_code = self.get_argument('zip_code')
db.put([customer, mobile, landline, location])
self.get()
示例2: get
# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import get_by_key_name [as 別名]
def get(self):
if not self.is_logged_in():
self.redirect(LOGIN_PAGE_URL)
else:
customer = Customer.get_by_key_name(self.get_current_username())
subscriptions = []
for order in customer.orders:
subscriptions.append(order.subscription)
self.render('unsubscribe.html', subscriptions=subscriptions)