I'm trying to create a pie chart with HighCharts with Django (Mac maverick).

This is my views.py

    def piechart(request):
        responses_pie =  
AnswerRadio.objects.values("body").annotate(Count("id"))
        res = []
        for cat in responses_pie:
            res.append([
                cat["body"],    
                cat["id__count"],
                ])
        return render(request, 'chart_code_v2.html', {'responses_pie_json': 
json.dumps(res)})

reponses_pie_json has 2 keys, body - string values - and id__cout - integer 
values. But, in template, I'm not getting how to input response_pie_json in 
data of HighCharts. I'm trying to use

data: {{ responses_pie_json|safe }}

But It just show a blank screen. What should i do?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6370df91-160b-4b8c-abb4-e578bee0c46b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to