當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。