Add data to tables

asked 2014-06-09 01:58:31 -0500

toby harris gravatar image

Hi,

I am trying to add a panel in OpenStack which displays some hard coded values. However when I am trying to access that data from the dashboard, I am getting the below error.

File "/usr/lib/python2.6/site-packages/horizon/tables/base.py", line 1498, in get_object_id
    return datum.id
TemplateSyntaxError: 'str' object has no attribute 'id'

Below is the extract from my views.py file

 def get_data(self):
                L = ["test","test1","test3","test4","test5","test6"]
                return L

Any idea on what could go wrong?

Thanks Toby

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-06-11 04:24:15 -0500

toby harris gravatar image

Ok, I was able to solve this issue. This is not the correct way to return the list having some data. There should be a key value combination.

strobj = '[{"id": "111", "name": "test", "email": "xyz@gmail.com", "phone": "123456",}]' 
instances = json.loads(strobj

)

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-06-09 01:58:31 -0500

Seen: 125 times

Last updated: Jun 11 '14