I'm trying to write a monitor site so the temperature for certain devices gets updated every x seconds. So far I have a function that returns a dictionary using dajaxice. This is my ajax.py:
def temperature(request):
  temperature_dict = {}
  for filter_device in TemperatureDevices.objects.all():
    get_objects = TemperatureData.objects.filter(Device=filter_device)
    current_object = get_objects.latest('Date')
    current_data = current_object.Data
    temperature_dict[filter_device] = current_data 
  table = str(temperature_dict)
  return simplejson.dumps({'table':table})
And this is my callback:
function my_callback(data){
    if(data!=Dajaxice.EXCEPTION){
       document.getElementById('test').innerHTML = data.table;
    }
    else{
        alert('Error');
    }
}
Dajaxice.toolbox.monitor.temperature('my_callback');
Originally, my html looks like this:
<div id="test"> <tr>
{% for label, value in table %}
      <td>{{ label }}
      </td>
      <td>{{ value }}
      </td>
{% endfor %}
    </tr></div>
How can I write this so I can iterate through the dictionary I get in dajax so that the output is similar to what I have in my original html using just django? Thanks in advance.