Chartjs-Getting dynamic data for chart.js from Django model

1👍

You need to provide the client in the URL:

url(r'^api/chart/data/<str:client>$', ChartData.as_view()),

and then you just have it in your get as a param:

def get(self, request, client):

I’m not sure why you have format=None there. It does not correspond to anything in your urls.py

Also, I would recommend not using Django REST framework’s APIView for something that is not an API view (e.g. you’re rendering a page, not providing a REST API endpoint).
For that, just use plain Django class based views.

Leave a comment