def add_sys(request): sys_name = request.POST.get('name') if sys_name is None: return HttpResponse() entry = SystemModel() entry.name = sys_name entry.desc = request.POST.get('desc') entry.save() if entry.id: msg = 'succ' return HttpResponse(msg)
now = datetime.now() return now.strftime(self.format_string) register.tag('current_time', do_current_time) ''' def add_log(request): data = dict(request.POST) sys_name = request.POST['sys'] mod_name = request.POST['mod'] func_name = request.POST['func'] try: open('/tmp/get','a').write(repr(request.POST)+'\n') except Exception,e: 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