Am having a challenge of displaying data into my template table, the 
function is;

def customers(request):
    if request.method == 'POST':
        accountno = request.POST['accountno']
        id= request.POST['id']
        Mobilenumber = request.POST['Mobilenumber']
    cursor = con.cursor()
    querystring = ("Select Messages, amount, date from Accounts where accountno 
= 'accountno' or Mobilenumber = 'Mobilenumber' ")

    cursor.execute(querystring)

    rows = cursor.fetchall()
    context = {'querystring': querystring}
    con.close()
    if cursor.rowcount == 0:
        return render(request,'kplcapp/customers.html', context)
    else:
        rows = cursor.fetchall()
        return render('kplcapp/customers.html', context)
    return render(request, 'kplcapp/customers.html', context)

    if 'print' in request.form:
        df = pd.DataFrame(result)
        df.to_excel(r"C:\Users\Public\Documents\data3.xlsx")
    else:
        return render(request, 'kplcapp/customers.html', context)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7ea3ac40-f879-4c4a-9b2a-bdd404763f88o%40googlegroups.com.

Reply via email to