5👍
✅
ValueQuerySet yields dictionaries. Get items by indexing, instead of accessing attributes.
Replace following lines:
for b in state_filter:
xdata.append(b.party)
ydata.append(b.num)
with:
for d in age_filter:
xdata.append(b['party'])
ydata.append(b['party_count'])
Source:stackexchange.com