def get(self): keyword = self.get_argument("keyword", None) page = int(self.get_argument("page", 1)) pagesize = self.settings['admin_pagesize'] aq = Apply.select() if keyword: keyword = keyword + '%' aq = aq.where((Apply.coname % keyword) | (Apply.mobile % keyword)) total = aq.count() applys = aq.paginate(page, pagesize) self.render('admin/apply.html', applys = applys, total = total, page = page, pagesize = pagesize)
def post(self): coname = self.get_argument("coname", None) city = self.get_argument("city", None) region = self.get_argument("region", None) address = self.get_argument("address", None) try: pnumber = int(self.get_argument("pnumber", 1)) except: pnumber = 1 name = self.get_argument("name", None) tel = self.get_argument("tel", None) mobile = self.get_argument("mobile", "") applyed = Apply() applyed.coname = coname applyed.city = city applyed.region = region applyed.address = address applyed.pnumber = pnumber applyed.name = name applyed.tel = tel applyed.mobile = mobile try: applyed.validate() applyed.save() self.flash("申请成功,请等待我们的消息。", "ok") self.redirect("/apply") return except Exception, ex: self.flash(str(ex))
def post(self): coname = self.get_argument("coname", None) city = self.get_argument("city", None) region = self.get_argument("region", None) address = self.get_argument("address", None) try: pnumber = int(self.get_argument("pnumber", 1)) except: pnumber = 1 name = self.get_argument("name", None) tel = self.get_argument("tel", None) mobile = self.get_argument("mobile", "") applyed = Apply() applyed.coname = coname applyed.city= city applyed.region = region applyed.address = address applyed.pnumber = pnumber applyed.name = name applyed.tel = tel applyed.mobile = mobile try: applyed.validate() applyed.save() self.flash("申请成功,请等待我们的消息。", "ok") self.redirect("/apply") return except Exception, ex: self.flash(str(ex))