Re: if condition in template not working

2011-08-06 Thread sakthi vel
ya it worked. thank you! On Sat, Aug 6, 2011 at 11:07 PM, Thomas Orozco wrote: > In your context you passed your 'lists' object as 'book'. > > So {% if book %} would work, but your current syntax won't. > Le 6 août 2011 19:32, "shakthi" a écrit : > > > The if condition in my html template is not

Re: if condition in template not working

2011-08-06 Thread Thomas Orozco
In your context you passed your 'lists' object as 'book'. So {% if book %} would work, but your current syntax won't. Le 6 août 2011 19:32, "shakthi" a écrit : > The if condition in my html template is not working, only else is > executing. > > view function is > def test(request): > lists=Book.o

Re: if condition in template not working

2011-08-06 Thread Shawn Milochik
This is because you're passing it as 'book' in the context. {% if book %} will evaluate to True. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group

if condition in template not working

2011-08-06 Thread shakthi
The if condition in my html template is not working, only else is executing. view function is def test(request): lists=Book.objects.all() return render_to_response('test.html',{'book':lists}) template file:test.html {% if lists %} {% for a in lists %} There are {{book|