コード例 #1
0
ファイル: admin.py プロジェクト: zouchao2010/cakeshop
    def post(self, cid):
        try:
            category = Category.get(id=cid)
        except:
            self.flash("此分类不存在")
            self.redirect("/admin/categorys")
            return

        name = self.get_argument("name", None)
        dec = self.get_argument("dec", "")
        order = int(self.get_argument("order", 1))

        categoryattr = CategoryAttr()
        categoryattr.cid = cid
        categoryattr.name = name
        categoryattr.dec = dec
        categoryattr.order = order

        try:
            categoryattr.validate()
            categoryattr.save()
            self.flash(u"分类属性%s添加成功" % name)
            self.redirect("/admin/categoryattrs/%d" % int(cid))
            return
        except Exception, ex:
            self.flash(str(ex))
コード例 #2
0
ファイル: admin.py プロジェクト: FashtimeDotCom/cakeshop
 def post(self, cid):
     try:
         category = Category.get(id = cid)
     except:
         self.flash("此分类不存在")
         self.redirect("/admin/categorys")
         return
     
     name = self.get_argument("name", None)
     dec = self.get_argument("dec", "")
     order = int(self.get_argument("order", 1))
         
     categoryattr = CategoryAttr()
     categoryattr.cid = cid
     categoryattr.name = name
     categoryattr.dec = dec
     categoryattr.order = order
     
     try:
         categoryattr.validate()
         categoryattr.save()
         self.flash(u"分类属性%s添加成功" % name)
         self.redirect("/admin/categoryattrs/%d" % int(cid))
         return
     except Exception, ex:
         self.flash(str(ex))