Ok thanks,
i just released that i have made a mistake. so basically here are my
template.html and view.py
i think there is a mistake in my view.py the display result is not what i
was looking for. can't seem to figure it out.
template.html
<table id="t01" >
<tr>
<th>Select to approve leave</th>
<th>First Name</th>
<th>Last Name</th>
<th>Position</th>
<th>Department</th>
<th>Leave Type</th>
<th>Details</th>
<th>Start Date</th>
<th>End Date</th>
<th>Total working days</th>
<th># of leave left</th>
<th> Department Head Authorization</th>
<th>Authorize By</th>
<th> Remarks</th>
<th>Authorized Date</th>
</tr>
{%for a in new_leave%}
<tr>
<td><a href ="/authorized_Leave/{{ a.id}}/"><input type="checkbox"
onClick="parent.location='#'" > </a> </td>
<td>{{a.first_name}}</td>
<td>{{a.last_name}}</td>
<td>{{a.position}}</td>
<td>{{a.department}}</td>
<td>{{a.leave_type}}</td>
<td>{{a.specify_details}}</td>
<td>{{a.start_date}}</td>
<td>{{a.end_date}}</td>
<td>{{a.total_working_days}}</td>
<td>{{a.total_Leave_Left}}</td>
<td>{{a.department_head_authorization}}</td>
<td>{{a.authorized_by}}</td>
<td>{{a.remarks}}</td>
<td>{{a.authorization_date}}</td>
</tr>
{%endfor%}
</table>
view.py
def FMKD1_leave_to_authorize(request):
new_leave
=newleave.objects.filter(department_head_authorization="Approved" )
new_leave = newleave.objects.filter(department="FMKD")
if new_leave.exists() and new_leave.exists():
return render_to_response('FMKD1_display_approve_leave.html',
locals())
On Fri, Jan 16, 2015 at 10:52 AM, Vijay Khemlani <[email protected]> wrote:
> in your view new_leave and a are QuerySet objects, and then you are
> comparing them to a string ("True") not a bolean (True without quotes), so
> it's always False.
>
> Even if you change "True" to True it won't work, try it like this
>
> if new_leave.exists() and a.exists():
> return ...
>
>
> On Thu, Jan 15, 2015 at 8:40 PM, sum abiut <[email protected]> wrote:
>
>>
>>
>> Hi,
>> I am trying to two column and display some result if two conditions are
>> meet but i am getting this error:
>>
>> The view eLeave.views.FMKD1_leave_to_authorize didn't return an HttpResponse
>> object. It returned None instead.
>>
>>
>> I can seems to figure out the issue, here is my view.py file
>>
>> def FMKD1_leave_to_authorize(request):
>> new_leave
>> =newleave.objects.filter(department_head_authorization="Approved" )
>> a = newleave.objects.filter(department="FMKD")
>> if new_leave=="True"and a =="True":
>> return render_to_response('FMKD1_display_approve_leave.html',
>> locals())
>>
>> --
>> 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 post to this group, send email to [email protected].
>> 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/CAPCf-y7uRsM8Vx6Jj5QD4ZY%2BCk24SkgCHZv-xMGZr49icPrmrA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPCf-y7uRsM8Vx6Jj5QD4ZY%2BCk24SkgCHZv-xMGZr49icPrmrA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 post to this group, send email to [email protected].
> 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/CALn3ei0QaQbwb%3DvkGJ6%2B4DB19p2ZDjTzJb1fSmoAhWUGg_H5PA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALn3ei0QaQbwb%3DvkGJ6%2B4DB19p2ZDjTzJb1fSmoAhWUGg_H5PA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 post to this group, send email to [email protected].
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/CAPCf-y6MXc2tR5wBBv9358TMoyBV5K5Ay8vHOSji104fBz1Ovg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.