Django Python shows me strange results if I use fetchall() command -


i used django framework , mysql database. tired show full names in row, , shows me encoded results on html page below. tried put decode option on python, didn't work well. if use fetchone() command, shows correct word. however, shows me different result if use fetchall() command. can see errors?

profile.py

cursor = connection.cursor() cursor.execute("select full_name myapp_profile order idx desc") results = cursor.fetchall()  x = cursor.description resultslist = []    r in results:     = 0     d = {}     while < len(x):         d[x[i][0]] = r[i]         = i+1     resultslist.append(d)  context = context({'data' : resultslist }) return httpresponse(loader.get_template('profile/profile_list.html').render(context)) 

result on html

{'full_name': u'\uae40\uc9c0\uc120'}  {'full_name': u'\uc774\uc8fc\ud604'}  {'full_name': u'\uae40\uae30\uc790'}  {'full_name': u'\uae40\uae30\uc131'}  {'full_name': u'\uae40\uc544\uc601'}  

html code wrong..

it before..

{% if data %}    there {{ data|length }} records:    {% e in data %}       <br />       <td> {{ e }} </td>       <br />    {% endfor %} {% else %}    there no records in system {% endif %} 

i changed this, , worked

{% if data %}    there {{ data|length }} records:    {% e in data %}       <br />       <td> {{ e.full_name }} </td>       <br />    {% endfor %} {% else %}    there no records in system {% endif %} 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -