File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -723,15 +723,18 @@ def save_new_project(request):
723723 elif data ['ptype_id' ] == settings .LOCAL_PTYPE_ID :
724724 # FIXME set internal PI in conf/settings maybe
725725 pi_id = INTERNAL_PI_PK
726- else :
726+ elif not ( newpiname := data . get ( 'newpiname' , False )) :
727727 try :
728728 pi_id = int (data ['pi_id' ])
729729 except ValueError :
730730 return JsonResponse ({'error' : 'Please select a PI' }, status = 403 )
731+ else :
732+ # This runs if newpiname, for linter, it will complain if not having this
733+ pi_id = False
731734
732735 if models .Project .objects .filter (name = data ['name' ]):
733736 return JsonResponse ({'error' : 'Project name already exists' }, status = 403 )
734- if ' newpiname' in data :
737+ if newpiname :
735738 pi_id = models .PrincipalInvestigator .objects .create (name = data ['newpiname' ]).pk
736739 project = models .Project .objects .create (name = data ['name' ], pi_id = pi_id ,
737740 ptype_id = data ['ptype_id' ], externalref = data ['extref' ])
You can’t perform that action at this time.
0 commit comments