def post(self): form = account_form.account_add_form() if not form.validates(source=self.get_params()): return self.render("base_form.html", form=form) if self.db.query(models.TTAccount).filter_by(account_number=form.d.account_number).count() > 0: return self.render("base_form.html", form=form, msg=u"账号已经存在") account = models.TTAccount() account.account_number = form.d.account_number account.password = form.d.password self.db.add(account) self.db.commit() self.redirect("/account", permanent=False)
def get(self): form = account_form.account_add_form() self.render("base_form.html",form=form)