当前位置: 首页>>代码示例>>Python>>正文


Python Item.query方法代码示例

本文整理汇总了Python中models.Item.query方法的典型用法代码示例。如果您正苦于以下问题:Python Item.query方法的具体用法?Python Item.query怎么用?Python Item.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Item的用法示例。


在下文中一共展示了Item.query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		user = users.get_current_user()
		items = Item.query().filter(Item.owner == user.email()).filter(Item.type == "Task").order(-Item.date).fetch()
		items += Item.query().filter(Item.owner == user.email()).filter(Item.type == "Knowledge").order(-Item.date).fetch()

		template_values = {
			'items':items,
                        'user':user
		}
		self.render("user_store.html", (template_values))
开发者ID:SuitPotato,项目名称:TeamZero,代码行数:12,代码来源:store_user.py

示例2: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		user = users.get_current_user()
		items = Item.query().filter(Item.type == 'Task').order(-Item.date).fetch()
		items += Item.query().filter(Item.type == 'Knowledge').order(-Item.date).fetch()
		
		template_values = {
			'items':items,
            'user': user
		}
		self.render("store.html", (template_values))
开发者ID:SuitPotato,项目名称:TeamZero,代码行数:12,代码来源:store_handler.py

示例3: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):

		items = Item.query().fetch()
		rooms = Room.query().fetch()
		relations = ItemRoomRelation.query().fetch()

		item_dicts = []
		for item in items:
			item_data = {}
			item_data["name"] = item.name
			item_data["category"] = item.category
			item_data["price"] = item.price
			item_data["encoded"] = urllib.quote(item.name)
			item_dicts.append(item_data)

		room_dicts = []
		for room in rooms:
			room_data = {}
			room_data["name"] = room.name
			room_dicts.append(room_data)

		template_data = {}
		template_data['items'] = item_dicts
		template_data['rooms'] = room_dicts
		template_data['relations'] = relations


		template = JINJA_ENVIRONMENT.get_template('admin.html')
		self.response.write(template.render(template_data))
开发者ID:alexweaver,项目名称:tdp-hackathon-2016,代码行数:31,代码来源:main.py

示例4: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		user = users.get_current_user()
		items = Item.query().filter(Item.type == 'Task').order(-Item.date).fetch()
		citem = self.request.get('citem')
		match = re.search(r'(\d+)',citem).group(0)
		
		for item in items:
			key = item.key
			id = re.search(r'(\d+)',str(key)).group(0)
			if id == match:
				passitem = item

# stuff that didnt work:
		#citem = Item.query('agxkZXZ-dGVhbXplcm9yEQsSBEl0ZW0YgICAgIDQhwgM')
		#itemkey = item.key()
		#Key('Item', 4572319104106496)	
		#item = Item.query().filter('__key__' == match)
		#item = Item.get_by_key_name(match)
		#item = Item.get_by_id(match)

		template_values = {
			'items':items,
            'user':user,
            'passitem':passitem
		}
		
		self.render("details_task.html", (template_values))
开发者ID:SuitPotato,项目名称:TeamZero,代码行数:29,代码来源:store_details_task.py

示例5: list

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
def list(query=None):
    ''' Generic listing function, called by every other pre-filtering
    listers (see below).'''
    
    if not query:
        query = Item.query()

    return render(query.fetch(), 200)
开发者ID:Hobbyhobbit,项目名称:Stock,代码行数:10,代码来源:rest.py

示例6: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		user = users.get_current_user()
		items = Item.query().filter(Item.type == "Project").order(-Item.date).fetch()

		template_values = {
			'items':items,
            'user':user
		}
		self.render("details_project.html", (template_values))
开发者ID:SuitPotato,项目名称:TeamZero,代码行数:11,代码来源:store_details_project.py

示例7: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		user = users.get_current_user()
		items = Item.query().filter(Item.type == 'Vehicles').order(-Item.date).fetch(10)

		template_values = {
			'items':items,
			'user':user
		}
		self.render("store.html", (template_values))
开发者ID:mitchellnau,项目名称:finalproject,代码行数:11,代码来源:store_vehicle.py

示例8: restaurantMenuItemJSON

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
def restaurantMenuItemJSON(categoryname, itenname):
    """API for a named item for a named category.

    Args: A category name and an item name

    Returns: JSON for a named item.
    """
    item = Item.query(Item).filter_by(name=itemname).one()
    return jsonify(Item=[item.serialize])
开发者ID:qgreg,项目名称:itemcatalog,代码行数:11,代码来源:views.py

示例9: getItemList

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def getItemList(self,request):
		print "creating Customer"
		c = []
		query1 = Item.query()
		print query1
		entity1 = query1.get()
		print entity1
		for q in query1:
			c.append(self._copyItemsToForm(q))
		return ItemList(itemList=c)
开发者ID:nipun0212,项目名称:Shiv-Dugdh-Bhandar,代码行数:12,代码来源:dairymanagement.py

示例10: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		template_values = {'items' : Item.query(),
		'user_is_admin' : 'Yes' if users.is_current_user_admin() else 'No',}
		
		template = JINJA_ENVIRONMENT.get_template('header.html')
		self.response.write(template.render()) 	
		template = JINJA_ENVIRONMENT.get_template('listings.html')
		self.response.write(template.render(template_values))
		template = JINJA_ENVIRONMENT.get_template('footer.html')
		self.response.write(template.render())
开发者ID:tonycorp,项目名称:marinaregistry,代码行数:12,代码来源:marina_listings.py

示例11: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
    def get(self):
        items_query = Item.query().order(Item.name)
        items = items_query.fetch(10)

        template_values = {
            'items': items,        
        }

        template = initialize.JINJA_ENVIRONMENT.get_template('index.html')
        self.response.write(template.render(template_values))
开发者ID:dements,项目名称:online-shop,代码行数:12,代码来源:handler.py

示例12: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def get(self):
		items = Item.query().fetch()
		pitem = self.request.get('pitem')
		match = re.search(r'(\d+)',pitem).group(0)

		for item in items:
			key = item.key
			id = re.search(r'(\d+)',str(key)).group(0)
			if id == match:
				passitem = item
    	
		user = users.get_current_user()
		self.render("push.html", {"passitem": passitem})
开发者ID:SuitPotato,项目名称:TeamZero,代码行数:15,代码来源:push_page.py

示例13: getOrder

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
	def getOrder(self,request):
		data = {}
		c = []
		for field in request.all_fields():
			data[field.name] = getattr(request,field.name)

		orders = Order.query(Order.custId == ndb.Key(Customer,data['custId']))
		for order in orders:
			setattr(order,'itemName',(Item.query(Item.key == order.itemId, projection = [Item.itemName])).get().itemName)
			logging.debug(order)
			logging.debug(order.key)
			c.append(self._copyOrderToForm(order))
			logging.debug(c)
		return ReturnCustOrderForm(orderList=c)
开发者ID:nipun0212,项目名称:Shiv-Dugdh-Bhandar,代码行数:16,代码来源:dairymanagement.py

示例14: post

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
 def post(self):
     user = users.get_current_user()
     item_name = self.request.get("item_name")
     item_description = self.request.get("item_description")
     item_price = float(self.request.get("item_price"))
     memento_user_query = ndb.gql("SELECT * from MementoUser WHERE user_name = :1", user.nickname())
     curr_memento_user = memento_user_query.get()
     curr_memento_user_key = curr_memento_user.key
     existing_items = Item.query(ancestor=curr_memento_user_key)
     alreadyExists = existing_items.filter(ndb.GenericProperty("item_name") == item_name)
     if (alreadyExists.count(limit=1000) == 0):
         new_item = Item(parent = curr_memento_user_key, item_name = item_name, item_price = item_price, item_description = item_description)
         new_item.put()
         curr_memento_user.user_data.get().inventory.append(new_item.key)
         curr_memento_user.user_data.get().put()
     self.redirect("/VendorHub")
开发者ID:,项目名称:,代码行数:18,代码来源:

示例15: get

# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import query [as 别名]
    def get(self):
    	user = users.get_current_user()
    	items = Item.query().order(-Item.date).fetch()
    	ditem = self.request.get('ditem')
    	match = re.search(r'(\d+)',ditem).group(0)

    	for item in items:
    		key = item.key
    		id = re.search(r'(\d+)',str(key)).group(0)
    		if id == match:
    			passitem = item
    			
    	# this was a test but doesn't work
    	#passitem.delete()
        
        #self.render("delete.html", {"passitem": passitem})
        self.render("delete.html", {"ditem": ditem})
开发者ID:SuitPotato,项目名称:TeamZero,代码行数:19,代码来源:delete_page.py


注:本文中的models.Item.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。