Inside view there is no forloop (unless you explicitly define it). forloop 
is defined only inside for loops in templates

Actually your code is somewhat weird.
You iterate all list until last without doing anything.

It is more efficient to use slicing

email = newleave.objects.all()[-1] # this is already last item
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') 

Other code is also not very understandable, but I can't help you, since 
don't understand what should be done.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac2740f3-2e60-44f7-860d-974550476cd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to