I have this VIEW below:
from django.shortcuts import render
from django.db import connections
def IndexView(request):
con_totvs = connections['totvs'].cursor()
with con_totvs as cursor:
cursor.execute("SELECT A1_NOME, A1_CGC FROM SA1010 WHERE D_E_L_E_T_ <> '*' ORDER BY A1_NOME")
select = cursor.fetchall()
# bla bla bla
context = {}
cursor.close ()
con_totvs.close ()
return render(request, "home.html", context)
Just like I use when creating models, in my template id like to do something like:
{% for i in SELECT %}
{{ i.A1_NOME }}
{% endfor %}
Is this possible? Ive been searching but i failed it
Edit:
print(select)
>>[('NAME_PERSON1', 'COD_PERSON1'), ('NAME_PERSON2', 'COD_PERSON2'), ...]