From: Radek Czajka Date: Tue, 11 Jun 2013 13:53:05 +0000 (+0200) Subject: Don't break catalogue.pdf on unknown dc:audience. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/8d44f8a426e5214327adefe2154cf9739798e47b?ds=inline Don't break catalogue.pdf on unknown dc:audience. --- diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index eab6b2de3..e80b8af73 100644 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -560,6 +560,7 @@ class Book(models.Model): return books_by_author, orphans, books_by_parent _audiences_pl = { + "SP": (1, u"szkoła podstawowa"), "SP1": (1, u"szkoła podstawowa"), "SP2": (1, u"szkoła podstawowa"), "P": (1, u"szkoła podstawowa"), @@ -569,7 +570,7 @@ class Book(models.Model): } def audiences_pl(self): audiences = self.extra_info.get('audiences', []) - audiences = sorted(set([self._audiences_pl[a] for a in audiences])) + audiences = sorted(set([self._audiences_pl.get(a, (99, a)) for a in audiences])) return [a[1] for a in audiences] def choose_fragment(self):