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


Python Shop.select方法代码示例

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


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

示例1: get

# 需要导入模块: from model import Shop [as 别名]
# 或者: from model.Shop import select [as 别名]
 def get(self):
     ads = Ad.select().limit(6)
     newest = []
     for shop in Shop.select(Shop.name, Shop.ename, Shop.cover, Shop.price).where((Shop.cid != 2) & (Shop.status != 9)).order_by(Shop.views.desc()).limit(6):
         shop.price = shop.price.split("~")[0]
         newest.append(shop)
     
     recomm = []
     for shop in Shop.select(Shop.name, Shop.ename, Shop.cover, Shop.price).where(Shop.status == 1).limit(6):
         shop.price = shop.price.split("~")[0]
         recomm.append(shop)
     self.render("site/index.html", ads = ads, newest = newest, recomm = recomm)
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:14,代码来源:site.py

示例2: get

# 需要导入模块: from model import Shop [as 别名]
# 或者: from model.Shop import select [as 别名]
 def get(self):
     page = int(self.get_argument("page", 1))
     pagesize = self.settings['admin_pagesize']
     
     sq = Shop.select(Shop.name, Shop.ename, Shop.cover, Shop.price).where(Shop.status == 1)
     total = sq.count()
     shops = sq.paginate(page, pagesize)
     
     self.render("shop/recomm.html", shops = shops, total = total, page = page, pagesize = pagesize)
开发者ID:finalbattle,项目名称:cakeshop,代码行数:11,代码来源:shop.py

示例3: get

# 需要导入模块: from model import Shop [as 别名]
# 或者: from model.Shop import select [as 别名]
    def get(self):
        ads = Ad.select().limit(6)
        newest = []
        for shop in Shop.select(Shop.name, Shop.ename, Shop.cover, Shop.price).where((Shop.cid != 2) & (Shop.status != 9)).order_by(Shop.views.desc()).limit(6):
            shop.price = shop.price.split("~")[0]
            newest.append(shop)
        
        recomm = []
        for shop in Shop.select(Shop.name, Shop.ename, Shop.cover, Shop.price).where(Shop.status == 1).limit(6):
            shop.price = shop.price.split("~")[0]
            recomm.append(shop)
 
	ccategory= None
        keyword = self.get_argument("keyword", None)
        
        page = int(self.get_argument("page", 1))
        order = self.get_argument("order", None)
        
        pagesize = self.settings['admin_pagesize']
        
        categorys = self.get_categorys()
        
        sq = Shop.select(Shop.name, Shop.ename, Shop.cover, Shop.price)
        total = sq.count()
        
        if ccategory:
            sq = sq.where((Shop.cid == ccategory.id) & (Shop.status != 9))
        elif keyword:
            keyword = "%" + keyword + "%"
            sq = sq.where((Shop.name % keyword) & (Shop.status != 9))
        else:
            sq = sq.where((Shop.cid != 2) & (Shop.status != 9))
        
        if order:
            sq = sq.order_by(Shop.orders.desc())
        else:
            sq = sq.order_by(Shop.views.desc())
        
        shops = []
        for shop in sq.paginate(page, pagesize):
            shop.price = shop.price.split("~")[0]
            shops.append(shop)
        
        self.render("responsive/index.html", ads = ads, newest = newest, recomm = recomm,ccategory = ccategory, categorys = categorys, shops = shops, total = total, page = page, pagesize = pagesize)
开发者ID:yanjinjin,项目名称:wxshop,代码行数:46,代码来源:site.py

示例4: get

# 需要导入模块: from model import Shop [as 别名]
# 或者: from model.Shop import select [as 别名]
 def get(self):
     page = int(self.get_argument("page", 1))
     cid = int(self.get_argument("cid", 0))
     status = int(self.get_argument("status", 0))
     pagesize = self.settings['admin_pagesize']
     
     categorys = self.get_categorys()
     
     sq = Shop.select()
     
     if cid > 0:
         sq = sq.where(Shop.cid == cid)
     
     if status > 0:
         sq = sq.where(Shop.status == status)
     
     total = sq.count()
     shops = sq.paginate(page, pagesize)
     
     self.render('admin/shop.html', categorys = categorys, shops = shops, total = total, page = page, pagesize = pagesize)
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:22,代码来源:admin.py


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