ya it worked. thank you!

On Sat, Aug 6, 2011 at 11:07 PM, Thomas Orozco <g.orozco.tho...@gmail.com>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" <sakth...@gmail.com> a écrit :
>
> > 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
> >
> > <html>
> > <body>
> > {% if lists %}
> > {% for a in lists %}
> > <p>There are {{book|length}} books.</p>
> > <ul><li>a.title</li></ul>
> > {% endfor %}
> > {%else%}
> > <p>no results</p>
> > {%endif%}
> > </body>
> > </html>
> >
> >
> > when i go to the url from the browser i got only "no results"
> > This is the case in other view functions also.
> >
> > --
> > 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, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> 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, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to