I have a list which looks like the following:
[(2,'09-07-2014')]
when I access this list at the client side I can access it using:
{% for item in list %}
console.log( {{ item.0 }} + ' and ' + {{ item.1 }} )
{% endfor %}
Problem is item.0
returns 2
as it should but item.1
returns -2012
as 9-7-2014
in integer representation would compute to -2012
.
How do I make the client side script realize this is a string not an integer.
Below is the whole listing of the code:
chartdata= getChartData(request.session['userphone'])
log.debug(chartdata)
return render(request,'users.html',{'table':table,'topics':request.session['topics'],'profilepic':request.session['profilepic'],'chartdata':chartdata,'time':str(time.time())})
The log.debug(chartdata)
returns the following in my log file:
[11/Jul/2013 18:02:15] DEBUG [karnadash.views:179] [(85, '2013-07-08'), (120, '2013-07-08'), (205, '2013-07-08'), (305, '2013-07-08'), (405, '2013-07-08'), (505, '2013-07-08'), (547, '2013-07-09'), (564, '2013-07-09'), (581, '2013-07-09'), (607, '2013-07-09'), (624, '2013-07-09'), (659, '2013-07-09'), (694, '2013-07-09'), (711, '2013-07-09'), (737, '2013-07-09'), (754, '2013-07-09'), (771, '2013-07-09'), (871, '2013-07-09')]