def roster_add_post(db): form = forms.roster_add_form() if not form.validates(source=request.forms): return render("sys_roster_form", form=form) if db.query(models.SlcRadRoster.id).filter_by( mac_addr=form.d.mac_addr).count() > 0: return render("sys_roster_form", form=form, msg=u"MAC地址已经存在") roster = models.SlcRadRoster() roster.mac_addr = form.d.mac_addr.replace("-", ":").upper() roster.begin_time = form.d.begin_time roster.end_time = form.d.end_time roster.roster_type = form.d.roster_type db.add(roster) 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"), serial_json(roster)) db.add(ops_log) db.commit() websock.update_cache("roster", mac_addr=roster.mac_addr) redirect("/roster")
def roster_add_post(db): form=forms.roster_add_form() if not form.validates(source=request.forms): return render("sys_roster_form", form=form) if db.query(models.SlcRadRoster.id).filter_by(mac_addr=form.d.mac_addr).count()>0: return render("sys_roster_form", form=form,msg=u"MAC地址已经存在") roster = models.SlcRadRoster() roster.mac_addr = form.d.mac_addr.replace("-",":").upper() roster.begin_time = form.d.begin_time roster.end_time = form.d.end_time roster.roster_type = form.d.roster_type db.add(roster) 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"),serial_json(roster)) db.add(ops_log) db.commit() websock.update_cache("roster",mac_addr=roster.mac_addr) redirect("/roster")
def roster_add(db): return render("sys_roster_form", form=forms.roster_add_form())
def roster_add(db): return render("sys_roster_form",form=forms.roster_add_form())