Created
July 26, 2017 20:35
-
-
Save dafma/82692c67a23ab46a91cc0577aa967b12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sql = "Select Referencia, Agente from Compra where Mov='PEDIDO' and Referencia='898-76' " | |
cursor = connection.cursor() | |
cursor.execute(sql) | |
todo_items = cursor.fetchall() | |
result = [] | |
keys = ('Referencia','Agente',) | |
for row in todo_items: | |
result.append(dict(zip(keys, row))) | |
#todo_items = ['Mow Lawn', 'Buy Groceries', ] | |
data = json.dumps(result) | |
return HttpResponse(data, content_type='application/json') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment