Remove root authoritiy from the list of authorities in Registration process
authorLoic Baron <loic.baron@lip6.fr>
Tue, 17 Mar 2015 13:18:28 +0000 (14:18 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Tue, 17 Mar 2015 13:18:28 +0000 (14:18 +0100)
portal/registrationview.py
portal/templates/fed4fire/fed4fire_registration_view.html
portal/templates/onelab/onelab_registration_view.html
portal/templates/registration_view.html

index d1c12ca..102e600 100644 (file)
@@ -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
index 31b5b9e..50b7fff 100644 (file)
@@ -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>
+                    <option value="">select an organization</option>
                 {% if authorities %}
                     {% for authority in authorities %}
                         {% if authority.name %}
index b764570..18af096 100644 (file)
                                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>
+                    <option value="">select an organization</option>
                 {% if authorities %}
                     {% for authority in authorities %}
                         {% if authority.name %}
-                            {% if authority.authority_hrn == authority_hrn %}
-                                <option value="{{ authority.authority_hrn }}" selected>{{authority.name}}</option>
-                            {% else %}
                                 <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
-                            {% endif %}
                         {% else %}
-                            {% if authority.authority_hrn == authority_hrn %}
-                            <option value="{{ authority.authority_hrn }}" selected>{{authority.authority_hrn}}</option>
-                            {% else %}
                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
-                            {% endif %}
                         {% endif %}
                     {% endfor %}               
                 {% else %}
index 6c04487..a469c13 100644 (file)
                 {% if authorities %}
                     {% for authority in authorities %}
                         {% if authority.name %}
-                            {% if authority.authority_hrn == authority_hrn %}
-                                <option value="{{ authority.authority_hrn }}" selected>{{authority.name}}</option>
-                            {% else %}
                                 <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
-                            {% endif %}
                         {% else %}
-                            {% if authority.authority_hrn == authority_hrn %}
-                            <option value="{{ authority.authority_hrn }}" selected>{{authority.authority_hrn}}</option>
-                            {% else %}
                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
                             {% endif %}
                         {% endif %}