title: Want to draw data using chartjs in django
body: <p>My application will take data using form and save it to the database and then draw it using chartjs .
  <b>I have tried this code but gives me an error. My code is as follows :</b> </p>
  
  <pre><code>def get_temperature_show(request):
  all_temperatures = Temper.objects.all()
  
  dates_label = []
  sensor1_temp = []
  sensor2_temp = []
  sensor3_temp = []
  sensor4_temp = []
  
  for model in all_temperatures:
      dates_label.append(model.date)
      sensor1_temp.append(model.sensor1_temp)
      sensor2_temp.append(model.sensor2_temp)
      sensor3_temp.append(model.sensor3_temp)
      sensor4_temp.append(model.sensor4_temp)
  
  data = {
      'dates': dates_label,
      'sensor1': sensor1_temp,
      'sensor2': sensor2_temp,
      'sensor3': sensor3_temp,
      'sensor4': sensor4_temp
  }
  
  return render(request, 'weather/showtemper.html', json.dumps({"data":data}))
  </code></pre>
  
  <p>But it gives the following-</p>
  
  <p><img src="https://i.stack.imgur.com/IsFgF.png" alt="datetime.date(2017, 4, 4) is not JSON serializable"></p>
  
  <p>My template example is like this:</p>
  
  <pre><code>var ctx = document.getElementById('myChart').getContext('2d');
  var myChart = new Chart(ctx, {
      type: 'line',
      data: {
          labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
          datasets: [{
              label: 'apples',
              data: [12, 19, 3, 17, 6, 3, 7],
              backgroundColor: "rgba(153,255,51,0.4)"
          }, {
              label: 'oranges',
              data: [2, 29, 5, 5, 2, 3, 10],
              backgroundColor: "rgba(255,153,0,0.4)"
          }]
      }
  });
  </code></pre>
  
  <p>Please help me to resolve this error</p>
  
  <p>Thanks in advance</p>