My Account: Platform access table - OK
authorYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 2 Sep 2013 15:46:10 +0000 (17:46 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 2 Sep 2013 15:46:10 +0000 (17:46 +0200)
portal/templates/my_account.html
portal/views.py

index 1500ce8..e67b600 100644 (file)
 
 
 <h2>Platform Access</h2>
-<table border="2" bordercolor="FFCC00" style="table-layout:fixedbackground-color:FFFFCCwidth:830px" cellpadding="12" cellspacing="12"> 
+<table border="2" bordercolor="C1DAD7" style="table-layout:fixedbackground-color:FFFFCCwidth:830px" cellpadding="12" cellspacing="12"> 
        <tr> 
        <th align="center" style="width:15%">Platform</th> 
         <th align="center" style="width:15%">Account Type</th> 
         <th align="center" style="width:15%">user_hrn</th>
         <th align="center">Pub Key</th>
-    </tr>            
+    </tr>   
+       {% for row in data %}         
        <tr>
-       <td align="center"> {{ platform_name }} </td>
-        <td align="center"> {{ account_type }} </td>
-               <td align="center" style="word-wrap: break-word"> {{ account_usr_hrn }}  </td>
-        <td align="center" style="word-wrap: break-word"> {{ account_pub_key }} </td>
-    </tr>                
+       <td align="center"> {{ row.platform_name }} </td>
+        <td align="center"> {{ row.account_type }} </td>
+               <td align="center" style="word-wrap: break-word"> {{ row.usr_hrn }}  </td>
+        <td align="center" style="word-wrap: break-word"> {{ row.usr_pubkey }} </td>
+    </tr> 
+       {%endfor%}               
 </table>
 
 
index de7a5ac..05ca958 100644 (file)
@@ -626,7 +626,11 @@ class AccountView(TemplateView):
         platform_name = ''
         account_type = ''
         account_usr_hrn = ''
-        account_pub_key = ''       
+        account_pub_key = ''
+        platform_name_list = []
+        account_type_list = []
+        usr_hrn_list = []
+        pub_key_list = []          
         for account_detail in account_details:
             for platform_detail in platform_details:
                 if platform_detail['platform_id'] == account_detail['platform_id']:
@@ -644,24 +648,19 @@ class AccountView(TemplateView):
                         account_pub_key = 'N/A'            
                         #print "THis is a test"
                         #print account_pub_key
+                    
+                    platform_name_list.append(platform_name)
+                    account_type_list.append(account_type)
+                    usr_hrn_list.append(account_usr_hrn)
+                    pub_key_list.append(account_pub_key)
         
-        #page.enqueue_query(network_query)
-
-        #page.expose_js_metadata()
-        #page.expose_queries()
-
-        #userlist = SimpleList(
-        #    title = None,
-        #    page  = page,
-        #    key   = 'user_id',
-        #    query = network_query,
-        #)
+        # combining 4 lists into 1 [to render in the template] 
+        lst = [{'platform_name': t[0], 'account_type': t[1], 'usr_hrn':t[2], 'usr_pubkey':t[3]} for t in zip(platform_name_list, account_type_list, usr_hrn_list, pub_key_list)]    
+        #print "test"
+        #print lst
 
         context = super(AccountView, self).get_context_data(**kwargs)
-        context['platform_name'] = platform_name
-        context['account_type'] = account_type
-        context['account_usr_hrn'] = account_usr_hrn
-        context['account_pub_key'] = account_pub_key 
+        context['data'] = lst
         context['person']   = self.request.user
         context ['fullname'] = config['firstname'] +' '+ config['lastname']    
         context ['firstname'] = config['firstname']