def delete_device(id): if require_login(): return redirect(url_for(login)) d = mdevice.get(mdevice.c.id == id) if cmp(d.adminname,request.user.username) and (request.user.is_superuser == False): return redirect('/message/只有设备管理者才能删除/-1') d.delete() return redirect('/message/删除完成/-2')
def display_device(device_name,id): d = mdevice.get(mdevice.c.id == id) r = mreg.filter(mreg.c.device_id == id) return {'r':r,'d':d}