def index(request):
conn = MySQLdb.connect(host="localhost", user="user", passwd="pwd", db="highchart_with_django")
cursor = conn.cursor()
cursor.execute("SELECT categories,tokyo,london,new_york,berlin FROM basic_line_chart")
row = cursor.fetchone()
while row is not None:
print row
row = cursor.fetchone()
return render(request, "linechart.html")
It's giving output like below:
('Sep', Decimal('7.00'), Decimal('3.90'), Decimal('-0.20'), Decimal('-0.90'))
('Oct', Decimal('6.90'), Decimal('4.20'), Decimal('0.80'), Decimal('0.60'))
expecting output:
["Sep", "7.00", "3.90", "-0.20", "-0.90"],["Oct", "6.90", "4.20", "0.80", "0.60"]
How can i achieve this. please help me with this.