Yes in an HTML template

On Saturday, June 20, 2020 at 6:41:57 PM UTC+3, Faith Mwai wrote:
>
> 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/831c3ce7-3902-4c90-9f3a-143b3418f293o%40googlegroups.com.

Reply via email to