def new_assets_approval(request): if request.method == 'POST': request.POST = request.POST.copy() approved_asset_list = request.POST.getlist('approved_asset_list') print approved_asset_list approved_asset_list = models.NewAssetApprovalZone.objects.filter( id__in=approved_asset_list) response_dic = {} for obj in approved_asset_list: print obj.data request.POST['asset_data'] = obj.data ass_handler = core.Asset(request) if ass_handler.data_is_valid_without_id(): ass_handler.data_inject() obj.approved = True obj.save() response_dic[obj.id] = ass_handler.response return render(request, 'assets/new_assets_approval.html', { 'new_assets': approved_asset_list, 'response_dic': response_dic }) else: ids = request.GET.get('ids') id_list = ids.split(',') new_assets = models.NewAssetApprovalZone.objects.filter(id__in=id_list) return render(request, 'assets/new_assets_approval.html', {'new_assets': new_assets})
def asset_with_no_asset_id(request): if request.method == 'POST': ass_handler = core.Asset(request) res = ass_handler.get_asset_id_by_sn() #return render(request,'assets/acquire_asset_id_test.html',{'response':res}) return HttpResponse(json.dumps(res))
def asset_report(request): print request.GET if request.method == 'POST': ass_handler = core.Asset(request) if ass_handler.data_is_valid(): ass_handler.data_inject() return HttpResponse(json.dumps(ass_handler.response)) return HttpResponse('--test--')
def asset_report(request): print(request.GET) if request.method == "POST": ass_handler = core.Asset(request) if ass_handler.data_is_valid(): print(" asset data valid") ass_handler.data_inject() return HttpResponse(json.dumps(ass_handler.response)) return HttpResponse("--test--")
def asset_report(request): print(request.GET) if request.method == 'POST': ass_handler = core.Asset(request) if ass_handler.data_is_valid(): ass_handler.data_inject() #return HttpResponse(json.dumps(ass_handler.response)) return HttpResponse(json.dumps(ass_handler.response)) #return render(request,'assets/asset_report_test.html',{'response':ass_handler.response}) #else: #return HttpResponse(json.dumps(ass_handler.response)) return HttpResponse('--3333test--')
def AssetWithNoAssetId(request): if request.method == 'POST': ass_handler = core.Asset(request) res = ass_handler.get_asset_id_by_sn() return HttpResponse(json.dumps(res))