def member_update(db): member_id = request.params.get("member_id") member = db.query(models.SlcMember).get(member_id) nodes = [(n.id, n.node_name) for n in db.query(models.SlcNode)] form = forms.member_update_form(nodes) form.fill(member) return render("base_form", form=form)
def member_update(db): member_id = request.params.get("member_id") member = db.query(models.SlcMember).get(member_id) nodes = [ (n.id,n.node_name) for n in db.query(models.SlcNode)] form = forms.member_update_form(nodes) form.fill(member) return render("base_form",form=form)
def member_update(db): nodes = [ (n.id,n.node_name) for n in db.query(models.SlcNode)] form=forms.member_update_form(nodes) if not form.validates(source=request.forms): return render("base_form", form=form) member = db.query(models.SlcMember).get(form.d.member_id) member.realname = form.d.realname if form.d.new_password: member.password = md5(form.d.new_password.encode()).hexdigest() member.idcard = form.d.idcard member.mobile = form.d.mobile member.address = form.d.address ops_log = models.SlcRadOperateLog() ops_log.operator_name = get_cookie("username") ops_log.operate_ip = get_cookie("login_ip") ops_log.operate_time = utils.get_currtime() ops_log.operate_desc = u'操作员(%s)修改用户信息:%s'%(get_cookie("username"),member.member_name) db.add(ops_log) db.commit() redirect(member_detail_url_formatter(member.member_id))