From f67ade2d281f726dfaf084dee293393721fce8d9 Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Tue, 17 Mar 2015 14:18:28 +0100 Subject: [PATCH] Remove root authoritiy from the list of authorities in Registration process --- portal/registrationview.py | 7 +++++-- .../templates/fed4fire/fed4fire_registration_view.html | 1 + portal/templates/onelab/onelab_registration_view.html | 9 +-------- portal/templates/registration_view.html | 7 ------- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/portal/registrationview.py b/portal/registrationview.py index d1c12ca5..102e6009 100644 --- a/portal/registrationview.py +++ b/portal/registrationview.py @@ -44,9 +44,12 @@ class RegistrationView (FreeAccessView, ThemeView): # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2 authorities_query = Query.get('authority').select('name', 'authority_hrn') authorities = execute_admin_query(wsgi_request, authorities_query) + print "RegistrationView authorities = ", authorities 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']) print "############ BREAKPOINT 1 #################" # Page rendering diff --git a/portal/templates/fed4fire/fed4fire_registration_view.html b/portal/templates/fed4fire/fed4fire_registration_view.html index 31b5b9ea..50b7fffd 100644 --- a/portal/templates/fed4fire/fed4fire_registration_view.html +++ b/portal/templates/fed4fire/fed4fire_registration_view.html @@ -35,6 +35,7 @@ title="Choose your organization (company/university) from the list that apears when you click in the field and start to type. Use the arrow keys to scroll through the list; type part of the name to narrow down the list. We will send an email to the managers that we have on record for your organization, asking them to validate your sign-up request." required> + {% if authorities %} {% for authority in authorities %} {% if authority.name %} diff --git a/portal/templates/onelab/onelab_registration_view.html b/portal/templates/onelab/onelab_registration_view.html index b7645700..18af0965 100644 --- a/portal/templates/onelab/onelab_registration_view.html +++ b/portal/templates/onelab/onelab_registration_view.html @@ -30,20 +30,13 @@ title="Choose your organization (company/university) from the list that apears when you click in the field and start to type. Use the arrow keys to scroll through the list; type part of the name to narrow down the list. We will send an email to the managers that we have on record for your organization, asking them to validate your sign-up request." required> + {% if authorities %} {% for authority in authorities %} {% if authority.name %} - {% if authority.authority_hrn == authority_hrn %} - - {% else %} - {% endif %} {% else %} - {% if authority.authority_hrn == authority_hrn %} - - {% else %} - {% endif %} {% endif %} {% endfor %} {% else %} diff --git a/portal/templates/registration_view.html b/portal/templates/registration_view.html index 6c044877..a469c134 100644 --- a/portal/templates/registration_view.html +++ b/portal/templates/registration_view.html @@ -38,15 +38,8 @@ {% if authorities %} {% for authority in authorities %} {% if authority.name %} - {% if authority.authority_hrn == authority_hrn %} - - {% else %} - {% endif %} {% else %} - {% if authority.authority_hrn == authority_hrn %} - - {% else %} {% endif %} {% endif %} -- 2.43.0