當前位置: 首頁>>代碼示例>>Python>>正文


Python Customer.query方法代碼示例

本文整理匯總了Python中models.Customer.query方法的典型用法代碼示例。如果您正苦於以下問題:Python Customer.query方法的具體用法?Python Customer.query怎麽用?Python Customer.query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Customer的用法示例。


在下文中一共展示了Customer.query方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: update_customer_credit_debit_total

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import query [as 別名]
	def update_customer_credit_debit_total(self,data,c_key,credit):
		x = Customer.query(ancestor = data['custId'])
		obj = c_key.get()
		obj.debit = obj.debit + data['orderPrice']
		obj.credit = obj.credit + credit
		obj.total = obj.debit - obj.credit
		obj.put()
開發者ID:nipun0212,項目名稱:Shiv-Dugdh-Bhandar,代碼行數:9,代碼來源:dairymanagement.py

示例2: getCustomerList

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import query [as 別名]
	def getCustomerList(self,request):
		c = []
		query1 = Customer.query()
		for q in query1:
			setattr(q,'custId',q.key)
			c.append(self._copyCustomerTotalDetailToForm(q))
								
		return CustomerList(customerList=c)
開發者ID:nipun0212,項目名稱:Shiv-Dugdh-Bhandar,代碼行數:10,代碼來源:dairymanagement.py

示例3: createCustomer

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import query [as 別名]
	def createCustomer(self,request):
		c_id = Customer.allocate_ids(size=1)[0]
		c_key = ndb.Key(Customer, c_id)
		data = {field.name: getattr(request, field.name) for field in request.all_fields()}
		data['key'] = c_key
		query = Customer.query().filter(Customer.mobileNumber == data['mobileNumber'])
		entity = query.get()
		if entity:
			raise Exception('unique_property must have a unique value!')
		Customer(**data).put()
		return self._copyCustomerToForm(c_key.get())
開發者ID:nipun0212,項目名稱:Shiv-Dugdh-Bhandar,代碼行數:13,代碼來源:dairymanagement.py

示例4: getDateSpecifiedPurchase

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import query [as 別名]
	def getDateSpecifiedPurchase(self,request):
		c = []
		d = []
		z = []
		dategiven=0
		data = {}
		query1 = Customer.query()
		entity1 = query1.get()
		for field in request.all_fields():
			if (field.name == 'itemId'):
				data[field.name] = ndb.Key(Item,getattr(request,field.name))
			else:
				data[field.name] = getattr(request,field.name) 
		logging.debug('date')
		logging.debug(data['date'])
		for q in query1:
			if(data['date'] != None):
				logging.debug(data['date'])
				f = datetime.datetime.strptime(data['date'], '%m/%d/%y').date()
			else:
				d = DailyOrder.query(DailyOrder.custId == q.key,projection = [DailyOrder.orderDate])
				for x in d:
					z.append(x.orderDate)
				f = heapq.nlargest(1,z)
				if f:
					f = f[0]
			y = -1
			logging.debug(f)
			if f:
				q1 = DailyOrder.query(ndb.AND(DailyOrder.custId == q.key, DailyOrder.orderDate == f, DailyOrder.itemId == data['itemId']),projection = [DailyOrder.itemQuantity])
				for q2 in q1:
					y = q2.itemQuantity
			else:
				y = -1
			logging.debug('query resulet')
			logging.debug(q1)
			for q2 in q1:
					logging.debug(q2)
			setattr(q,'itemQuantity',float(y))
			setattr(q,'custId',q.key)
			c.append(self._copyCustomerItemQuantityToForm(q))
			z = []
			
			
		return CustomerShortFormList(custItemQuantityList=c)
開發者ID:nipun0212,項目名稱:Shiv-Dugdh-Bhandar,代碼行數:47,代碼來源:dairymanagement.py


注:本文中的models.Customer.query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。