text: Q:
  
  Multi-series Highchart chart from Django
  
  I've been creating some Highcharts via Django in this fashion:
  ...get rows from database
              rows = cursor.fetchall()
  
              months = list()
              avg_class = list()
  
              for i in range(0, len(rows)):
                  months.append(rows[i][2])
                  avg_class.append(rows[i][5])
  
              months_j = json.dumps(months, cls=DecimalandDateEncoder)
              avg_class_j = json.dumps(avg_class, cls=DecimalandDateEncoder)
  send to my template....
  
  Which contains the javascript for the chart in something like this.
              xAxis: {
                  type: 'datetime',
                  categories: {{ months|safe }},
                  etc...........
              },
              series: [{
                  name: 'Series Name',
                  data: {{ avgclassdata }}
              }]
  
  This works just fine, with data such as this.
  Month       Avg Class Data
  1/1/2012    17.600493
  2/1/2012    18.114341
  3/1/2012    16.246443
  4/1/2012    16.09489
  
  Now, I have data like this:
  Location    Month   Avg Class Data
  Location 1  1/1/2012    17.600493
  Location 1  2/1/2012    18.114341
  Location 1  3/1/2012    16.246443
  Location 1  4/1/2012    16.09489
  Location 2  1/1/2012    21.56584
  Location 2  2/1/2012    19.54654
  Location 2  3/1/2012    17.54654
  Location 2  4/1/2012    20.54551
  
  This could be any number of locations. And I want to create a Highchart using each location group as a series. I'm at a bit of a loss as how to loop through my rows results and use the location as the series name and then the corresponding average class data as the series data.
  My end goal is to create this from my database results:
              xAxis: {
                  type: 'datetime',
                  categories: {{ months|safe }},
                  etc...........
              },
              series: [{
                  name: Here would go the name of Location 1,
                  data: {{ location 1 data }}
              }, {
                  name: Here would go the name of Location 2,
                  data: {{ location 2 data }}
              }]
  
  I'd prefer just a push in the right direction, rather than somebody just write the code for me. Any assistance is appreciated!
  
  A:
  
   xAxis: {
       type: 'datetime',
       categories: {{ months|safe }},
       etc...........
   },series: [
          {% for location in locations %}
          {
              name: Here would go the name of {{location.name}},
              data: [
                 {% for data in location_data %}
                 {{data}},
                 {% endfor %}
              ]
          },
          {% endfor %}
   ]
  
  