Skip to content Skip to sidebar Skip to footer

Django - Object Is Not Subscriptable Django Charts.js" Or Nothing Displays At All?

i'm trying to display data on my charts using some model values and charts.js. My values are a country field and a class method that i'm not sure how I'm to call it. I keep getting

Solution 1:

This error

"TypeError: 'Organization' object is not subscriptable django charts.js"

suggests that you are trying to get an element out of an Organization object that isn't a dictionary, list, or a tuple.

I suspect the likely cause of this may be stemming from the following (though you can confirm this with the full error trace which should tell you the line of code that is causing the error):

for org in orgz:
  labels.append(org['country'])
  labels.append(org['Total_Scores'])

You should try to debug the values of this and verify that they are correct.

Post a Comment for "Django - Object Is Not Subscriptable Django Charts.js" Or Nothing Displays At All?"