当前位置: 首页>>代码示例>>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;未经允许,请勿转载。