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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.