SQL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from django.db import connection
@render_to('test.html')
def test(request)
cursor = connection.cursor()
cursor.execute("SELECT * FROM auth_user WHERE id= %s", [17])
row = cursor.fetchone()
dow = {}
dow['id'] = row[0]
dow['username'] = row[1]
#raise Exception(dow)
return {'dow':dow}
#################################################################
#template
{{ dow.username }}