0

I have started learning django. I was trying to displaying the query result in a html page using this code:

<ul>
   {% for book in booklist %}
     <li>{{ book.bid book.name  }}<li>
   {% endfor %}
</ul>

This gives me an error saying,

Exception Type: TemplateSyntaxError
Exception Value: Could not parse the remainder: ' book.name' from 'book.bid book.name'

But when i either remove book.bid or book.name, it works fine. How do i make both the attributes to be shown?

4

1 回答 1

4

您需要使用两个单独的标签。

{% for book in booklist %}
    <li>{{ book.bid }} {{ book.name }}</li>
{% endfor %}
于 2013-08-07T19:16:09.457 回答