def add_device(soc_name,id): if require_login(): return redirect(url_for(login)) form = DeviceForm() if request.method == 'GET': return {'form':form} elif request.method == 'POST': flag = form.validate(request.params) if flag: n = mdevice(**form.data) s = mdevice.filter(mdevice.c.device_name == form.data.device_name)\ .filter(mdevice.c.soc_name == soc_name) for s1 in s: return redirect('/message/添加错误,重名/-1') n.soc_name=soc_name n.adminname = request.user n.save() return redirect('/regs/')
def display_soc(soc_name,id): s = msoc.get(msoc.c.id == id) d = mdevice.filter(mdevice.c.soc_name == soc_name) return {'s':s,'d':d}