def get(self): domains = [(m.domain_code, m.domain_desc) for m in self.db.query(models.TrwDomain)] ssid_id = self.get_argument("ssid_id") mssid = self.db.query(models.TrwSsid).get(ssid_id) form = ssid_form.ssid_update_form(domains) form.fill(mssid) return self.render("base_form.html", form=form)
def post(self): form = ssid_form.ssid_update_form([]) if not form.validates(source=self.get_params()): return self.render("base_form.html", form=form) mssid = self.db.query(models.TrwSsid).get(form.d.id) mssid.domain_code = form.d.domain_code mssid.ssid_desc = form.d.ssid_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)修改SSID信息:%s' % (ops_log.operator_name, mssid.ssid) self.db.add(ops_log) self.db.commit() self.redirect("/ssid",permanent=False)