X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/64af15fe792f42d3a7dc3e857a45577d16806255..998a1e2aeaea0c5361e526365d1e94d7eaa9d4e8:/src/catalogue/models/book.py diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 923a60485..c0d47f9e2 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -127,7 +127,7 @@ class Book(models.Model): verbose_name_plural = _('books') app_label = 'catalogue' - def __unicode__(self): + def __str__(self): return self.title def get_initial(self): @@ -188,7 +188,7 @@ class Book(models.Model): from sortify import sortify self.sort_key = sortify(self.title)[:120] - self.title = unicode(self.title) # ??? + self.title = str(self.title) # ??? try: author = self.authors().first().sort_key @@ -401,7 +401,7 @@ class Book(models.Model): index.index_tags() if commit: index.index.commit() - except Exception, e: + except Exception as e: index.index.rollback() raise e @@ -672,7 +672,7 @@ class Book(models.Model): def publisher(self): publisher = self.extra_info['publisher'] - if isinstance(publisher, basestring): + if isinstance(publisher, str): return publisher elif isinstance(publisher, list): return ', '.join(publisher) @@ -697,7 +697,7 @@ class Book(models.Model): """ books_by_parent = {} - books = cls.objects.order_by('parent_number', 'sort_key').only('title', 'parent', 'slug') + books = cls.objects.order_by('parent_number', 'sort_key').only('title', 'parent', 'slug', 'extra_info') if book_filter: books = books.filter(book_filter).distinct()