本文整理汇总了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)
示例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)
示例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)
示例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)