return capfirst(', '.join(title))
+def book_stub_title(book):
+ return ', '.join((book.author, book.title))
+
+
@register.simple_tag
def book_title(book, html_links=False):
- names = list(book.tags.filter(category='author'))
+ try:
+ names = list(book.tags.filter(category='author'))
+ except AttributeError:
+ return book_stub_title(book)
books = []
while book:
type = 'book'
else:
type = match.category
- return dict(models.TAG_CATEGORIES)[type]
+ return type
}
+/* ================== */
+/* = Search matches = */
+/* ================== */
+
+.matches li:first-letter {
+ text-transform: uppercase;
+}
+
/* ============= */
/* = Tags list = */
/* ============= */
<div id="books-list">
<p>{% trans "More than one result matching the criteria found." %}</p>
- <ul class='matches'>
+ <ul class='matches'>
{% for match, link, type in results %}
- <li><a href='{{ link }}'>{{ match.name }}</a> ({{ type }})</li>
+ <li>{% trans type %}: <a href='{{ link }}'>
+ {% ifequal type "book" %}
+ {% book_title match %}
+ {% else %}
+ {{ match.name }}
+ {% endifequal %}
+ </a></li>
{% endfor %}
- </ul>
+ </ul>
</div>
<div id="set-window">