From 4d631eaaa0936add1c71b7e9ac2601c8533556fd Mon Sep 17 00:00:00 2001 From: Yasin Date: Mon, 2 Sep 2013 17:46:10 +0200 Subject: [PATCH] My Account: Platform access table - OK --- portal/templates/my_account.html | 16 +++++++++------- portal/views.py | 31 +++++++++++++++---------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/portal/templates/my_account.html b/portal/templates/my_account.html index 1500ce89..e67b6000 100644 --- a/portal/templates/my_account.html +++ b/portal/templates/my_account.html @@ -13,19 +13,21 @@

Platform Access

- +
- + + {% for row in data %} - - - - - + + + + + + {%endfor%}
Platform Account Type user_hrn Pub Key
{{ platform_name }} {{ account_type }} {{ account_usr_hrn }} {{ account_pub_key }}
{{ row.platform_name }} {{ row.account_type }} {{ row.usr_hrn }} {{ row.usr_pubkey }}
diff --git a/portal/views.py b/portal/views.py index de7a5ac8..05ca9589 100644 --- a/portal/views.py +++ b/portal/views.py @@ -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'] -- 2.43.0