X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fprojectrequestview.py;h=819cce590432634fe3cd7ab9fd8c16d215aec51c;hb=63092e5050fcd3a980cc1936a5b858720dccba3a;hp=8a48428263c80cb013f056b93b6e14e2f41bb1ac;hpb=c7309b368c2a6dcea1a231c9277b7e1fd118f266;p=unfold.git diff --git a/portal/projectrequestview.py b/portal/projectrequestview.py index 8a484282..819cce59 100644 --- a/portal/projectrequestview.py +++ b/portal/projectrequestview.py @@ -20,8 +20,10 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView): authorities_query = Query.get('authority').select('name', 'authority_hrn') authorities = execute_admin_query(request, authorities_query) if authorities is not None: - authorities = sorted(authorities, key=lambda k: k['authority_hrn']) - authorities = sorted(authorities, key=lambda k: k['name']) + # Remove the root authority from the list + matching = [s for s in authorities if "." in s['authority_hrn']] + authorities = sorted(matching, key=lambda k: k['authority_hrn']) + authorities = sorted(matching, key=lambda k: k['name']) return authorities def getUserAuthority(self, request): @@ -104,9 +106,13 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView): 'project_name' : wsgi_request.POST.get('project_name', ''), 'purpose' : wsgi_request.POST.get('purpose', ''), } + + # for new projects max project_name length is 10 + if (len(post['project_name']) >10): + errors.append('Project name can be maximum 10 characters long') - if (post['authority_hrn'] is None or post['authority_hrn'] == ''): - errors.append('Organization is mandatory') + #if (post['authority_hrn'] is None or post['authority_hrn'] == ''): + # errors.append('Organization is mandatory') if (post['purpose'] is None or post['purpose'] == ''): errors.append('Project purpose is mandatory') @@ -116,7 +122,7 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView): # What kind of project name is valid? if (post['project_name'] is None or post['project_name'] == ''): - errors.append('Project name is mandatory') + errors.append('Project name is mandatory') if not errors: print "is_pi on auth_hrn = ", user_authority