def getAllProtocolInfo(datasetID): ''' Retrieve all info of a protocol :param datasetID: ID of the dataset (protocol) to get all information from :return: dictionary with all information of the dataset ''' coreData = BasicDataset.objects.get(id=datasetID) formCore = BasicDatasetForm(instance=coreData, auto_id='id_basic_%s') # Load in data existingExperimentInfoDict = functions.getExperimentInfoDict(datasetID) existingPartnersList = functions.getPartnersList(datasetID) existingReqsList = functions.getListSteps(datasetID, DataReq) existingExpStepsList = functions.getListSteps(datasetID, ExpStep) existingReportingsList = functions.getListSteps(datasetID, Reporting) formPartner = PartnerForm(auto_id='id_partner_%s') formDataReq = DataReqForm(auto_id='id_req_%s') formExpStep = ExpStepForm(auto_id='id_exp_%s') formReporting = ReportingForm(auto_id='id_reporting_%s') formList = [ ['Basic', formCore], ['Partner', formPartner], ['DataReq', formDataReq], ['ExpStep', formExpStep], ['Reporting', formReporting], ] context = {} context.update({ 'edit': True, 'dataset_id': datasetID, 'existingExperimentInfoJSON': json.dumps(existingExperimentInfoDict), 'existingPartnersJSON': json.dumps(existingPartnersList), 'existingReqsJSON': json.dumps(existingReqsList), 'existingExpStepsJSON': json.dumps(existingExpStepsList), 'existingReportingsJSON': json.dumps(existingReportingsList), 'forms_list': formList }) return context
def decreaseReq(request): postDict = request.POST.dict() functions.decreaseTaskNr(postDict['datasetID'], postDict['reqID'], DataReq) # send back the new Reqs model as a list to use client side existingReqsList = functions.getListSteps(postDict['datasetID'], DataReq) return JsonResponse({'existingListJSON': json.dumps(existingReqsList)})
def decreaseReporting(request): postDict = request.POST.dict() functions.decreaseTaskNr(postDict['datasetID'], postDict['reportingID'], Reporting) # send back the new Reportings model as a list to use client side existingReportingsList = functions.getListSteps(postDict['datasetID'], Reporting) return JsonResponse({'existingListJSON': json.dumps(existingReportingsList)})
def decreaseExpStep(request): postDict = request.POST.dict() functions.decreaseTaskNr(postDict['datasetID'], postDict['expStepID'], ExpStep) # send back the new ExpSteps model as a list to use client side existingExpStepsList = functions.getListSteps(postDict['datasetID'], ExpStep) return JsonResponse({'existingListJSON': json.dumps(existingExpStepsList)})
def increaseReq(request): postDict = request.POST.dict() functions.increaseTaskNr(postDict['datasetID'], postDict['reqID'], DataReq) # send back the new Reqs model as a list to use client side existingReqsList = functions.getListSteps(postDict['datasetID'], DataReq) return JsonResponse({'existingListJSON': json.dumps(existingReqsList)})
def updateReq(request): postDict = request.POST.dict() # update the Request model based on the post information from the client functions.createStepModelFromClient(postDict, True, DataReq) # send back the new Request model as a list to use client side existingReqsList = functions.getListSteps(postDict['datasetID'], DataReq) return JsonResponse({'existingListJSON': json.dumps(existingReqsList)})
def deleteReporting(request): postDict = request.POST.dict() functions.updateTaskNrs(postDict['datasetID'], postDict['stepID'], Reporting) Reporting.objects.filter(id=postDict['stepID']).delete() # send back the new Reportings model as a list to use client side existingReportingsList = functions.getListSteps(postDict['datasetID'], Reporting) return JsonResponse({'existingListJSON': json.dumps(existingReportingsList)})
def updateReporting(request): postDict = request.POST.dict() # update the Reporting model based on the post information from the client functions.createStepModelFromClient(postDict, True, Reporting) # send back the new Reportings model as a list to use client side existingReportingsList = functions.getListSteps(postDict['datasetID'], Reporting) return JsonResponse({'existingListJSON': json.dumps(existingReportingsList)})
def addExpStep(request): postDict = request.POST.dict() # add a new ExpStep model based on the post information from the client functions.createStepModelFromClient(postDict, False, ExpStep) # send back the new ExpSteps model as a list to use client side existingExpStepsList = functions.getListSteps(postDict['datasetID'], ExpStep) return JsonResponse({'existingListJSON': json.dumps(existingExpStepsList)})
def increaseReporting(request): postDict = request.POST.dict() functions.increaseTaskNr(postDict['datasetID'], postDict['reportingID'], Reporting) # send back the new Reportings model as a list to use client side existingReportingsList = functions.getListSteps(postDict['datasetID'], Reporting) return JsonResponse( {'existingListJSON': json.dumps(existingReportingsList)})
def deleteReq(request): postDict = request.POST.dict() functions.updateTaskNrs(postDict['datasetID'], postDict['stepID'], DataReq) DataReq.objects.filter(id=postDict['stepID']).delete() # send back the new Request model as a list to use client side existingReqsList = functions.getListSteps(postDict['datasetID'], DataReq) return JsonResponse({'existingListJSON': json.dumps(existingReqsList)})