Hi,
i am getting an error as below when iterating throw rows. Basically what i want to do is iterate through number of rows. When on the last row i want to compare a column then send out an email.
here is the error that i am getting:
global name 'forloop' is not defined
here is my view.py:
def email_authorizer(request):
new_leave=newleave.objects.all()
for email in new_leave:
if forloop.last:
govoffice=newleave.objects.filter(department="GOV")
if govoffice.exists():
to_emails = [u.email for u in User.objects.filter(username__in['testuser','sabiut'])]
send_mail("RBV Leave Application Email Testing", "You have received a leave application form. Please login to the leave system to Authorize the leave.",
"RBV eLeave <Rbv_eLeave_System>", [to_emails])
return render_to_response('thankyou.html')