def add_mod(request): sys_id = request.POST.get('sys_id') name = request.POST.get('name') if sys_id is None or name is None: return HttpResponse(ret) mod = ModuleModel() mod.sys_id = sys_id mod.name = name mod.save() if mod.id: msg = 'succ' return HttpResponse(msg)
open('/tmp/get','a').write(e+'\n') sys = SystemModel.objects(name = sys_name) if not sys: sys = SystemModel() sys.name = sys_name sys.save() sys_id = sys.id else: sys_id = sys[0].id mod = ModuleModel.objects(sys_id = sys_id,name = mod_name) if not mod: mod = ModuleModel() mod.sys_id = sys_id mod.name = mod_name mod.save() mod_id = mod.id else: mod_id = mod[0].id func = FuncModel.objects(mod_id = mod_id,name = func_name) if not func: func = FuncModel() func.mod_id = mod_id func.name = func_name func.save() func_id = func.id else: func_id = func[0].id
def up_mod(request): mod_id = '50c1994c14908d14c1069699' mod = ModuleModel(id=mod_id) mod.name = 'test' mod.save() return HttpResponse('a')