fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DE and EN translations, fixed errors in .po files and compilation. Need to add fixtur...
[wolnelektury.git]
/
apps
/
catalogue
/
templatetags
/
catalogue_tags.py
diff --git
a/apps/catalogue/templatetags/catalogue_tags.py
b/apps/catalogue/templatetags/catalogue_tags.py
index
36a015a
..
9475348
100644
(file)
--- a/
apps/catalogue/templatetags/catalogue_tags.py
+++ b/
apps/catalogue/templatetags/catalogue_tags.py
@@
-61,9
+61,16
@@
def simple_title(tags):
return capfirst(', '.join(title))
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):
@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:
books = []
while book:
@@
-253,6
+260,7
@@
def tag_list(tags, choices=None):
@register.inclusion_tag('catalogue/folded_tag_list.html')
def folded_tag_list(tags, choices=None):
@register.inclusion_tag('catalogue/folded_tag_list.html')
def folded_tag_list(tags, choices=None):
+ tags = [tag for tag in tags if tag.count]
if choices is None:
choices = []
some_tags_hidden = False
if choices is None:
choices = []
some_tags_hidden = False