Beispiel #1
0
    def get(self, ename):

        try:
            shop = Shop.get(ename=ename)
            shop.views = shop.views + 1
            shop.save()
            category = Category.get(id=shop.cid)
        except:
            raise HTTPError(404)
            return

        categoryattrs = CategoryAttr.select().where(
            CategoryAttr.cid == shop.cid)
        shopattrs = ShopAttr.select().where(ShopAttr.sid == shop.id)
        if shop.args:
            shop.args = simplejson.loads(shop.args)
        pics = ShopPic.select().where(ShopPic.sid == shop.id)

        recomshops = Shop.select().where((Shop.status == 1)
                                         & (Shop.id != shop.id)).paginate(
                                             1, 5)
        self.render("shop/shop.html",
                    shop=shop,
                    category=category,
                    categoryattrs=categoryattrs,
                    shopattrs=shopattrs,
                    pics=pics,
                    recomshops=recomshops)
Beispiel #2
0
 def get(self, sid):
     try:
         shop = Shop.get(id = sid)
     except:
         self.flash("此商品不存在")
         self.redirect("/admin/addshop")
         return
     
     shopattrs = [shopattr for shopattr in ShopAttr.select().where(ShopAttr.sid == sid)]
     self.render('admin/shopattr.html', shop = shop, shopattrs = shopattrs)
Beispiel #3
0
 def get(self, ename):
     
     try:
         shop = Shop.get(ename = ename)
         shop.views = shop.views + 1
         shop.save()
         category = Category.get(id = shop.cid)
     except:
         raise HTTPError(404)
         return
     
     categoryattrs = CategoryAttr.select().where(CategoryAttr.cid == shop.cid)
     shopattrs = ShopAttr.select().where(ShopAttr.sid == shop.id)
     if shop.args:
         shop.args = simplejson.loads(shop.args)
     pics = ShopPic.select().where(ShopPic.sid == shop.id)
     
     recomshops = Shop.select().where((Shop.status == 1) & (Shop.id != shop.id)).paginate(1, 5)
     self.render("shop/shop.html", shop = shop, category = category, categoryattrs = categoryattrs, shopattrs = shopattrs, pics = pics, recomshops = recomshops)