update table style
[wolnelektury.git] / src / catalogue / models / book.py
index db50f3e..8dc39fe 100644 (file)
@@ -121,6 +121,17 @@ class Book(models.Model):
     def author_unicode(self):
         return self.tag_unicode('author')
 
+    def translator(self):
+        translators = self.extra_info.get('translators')
+        if not translators:
+            return None
+        if len(translators) > 3:
+            translators = translators[:2]
+            others = ' i inni'
+        else:
+            others = ''
+        return ', '.join(u'\xa0'.join(reversed(translator.split(', ', 1))) for translator in translators) + others
+
     def save(self, force_insert=False, force_update=False, **kwargs):
         from sortify import sortify
 
@@ -561,6 +572,7 @@ class Book(models.Model):
         "SP": (1, u"szkoła podstawowa"),
         "SP1": (1, u"szkoła podstawowa"),
         "SP2": (1, u"szkoła podstawowa"),
+        "SP3": (1, u"szkoła podstawowa"),
         "P": (1, u"szkoła podstawowa"),
         "G": (2, u"gimnazjum"),
         "L": (3, u"liceum"),