def get(self): domain_id = self.get_argument("domain_id") tpls = [(t.tpl_name, t.tpl_desc) for t in self.db.query(models.TrwTemplate)] isps = [(t.isp_code, t.isp_name) for t in self.db.query(models.TrwIsp)] form = domain_form.domain_update_vform(tpls=tpls,isps=isps) form.fill(self.db.query(models.TrwDomain).get(domain_id)) return self.render("base_form.html", form=form)
def post(self): tpls = [(t.tpl_name, t.tpl_desc) for t in self.db.query(models.TrwTemplate)] isps = [(t.isp_code, t.isp_name) for t in self.db.query(models.TrwIsp)] form = domain_form.domain_update_vform(tpls=tpls,isps=isps) if not form.validates(source=self.get_params()): return self.render("base_form.html", form=form) domain = self.db.query(models.TrwDomain).get(form.d.id) domain.tpl_name = form.d.tpl_name domain.domain_desc = form.d.domain_desc self.add_oplog( u'修改域信息:%s' % (domain.domain_code)) self.db.commit() self.redirect("/domain",permanent=False)
def post(self): tpls = [(t.tpl_name, t.tpl_desc) for t in self.db.query(models.TrwTemplate)] form = domain_form.domain_update_vform(tpls=tpls) if not form.validates(source=self.get_params()): return self.render("base_form.html", form=form) domain = self.db.query(models.TrwDomain).get(form.d.id) domain.tpl_name = form.d.tpl_name domain.domain_desc = form.d.domain_desc ops_log = models.TrwOperateLog() ops_log.operator_name = self.get_secure_cookie("tra_user") ops_log.operate_ip = self.get_secure_cookie("tra_login_ip") ops_log.operate_time = utils.get_currtime() ops_log.operate_desc = u'操作员(%s)修改域信息:%s' % (ops_log.operator_name, domain.domain_code) self.db.add(ops_log) self.db.commit() self.redirect("/domain",permanent=False)