fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Str/bytes fix for publishing audiobooks.
[wolnelektury.git]
/
src
/
catalogue
/
models
/
book.py
diff --git
a/src/catalogue/models/book.py
b/src/catalogue/models/book.py
index
b2289f6
..
c0d47f9
100644
(file)
--- 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'
verbose_name_plural = _('books')
app_label = 'catalogue'
- def __
unicode
__(self):
+ def __
str
__(self):
return self.title
def get_initial(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]
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
try:
author = self.authors().first().sort_key
@@
-205,12
+205,7
@@
class Book(models.Model):
@permalink
def get_absolute_url(self):
@permalink
def get_absolute_url(self):
- return 'catalogue.views.book_detail', [self.slug]
-
- @staticmethod
- @permalink
- def create_url(slug):
- return 'catalogue.views.book_detail', [slug]
+ return 'book_detail', [self.slug]
def gallery_path(self):
return gallery_path(self.slug)
def gallery_path(self):
return gallery_path(self.slug)
@@
-406,7
+401,7
@@
class Book(models.Model):
index.index_tags()
if commit:
index.index.commit()
index.index_tags()
if commit:
index.index.commit()
- except Exception
,
e:
+ except Exception
as
e:
index.index.rollback()
raise e
index.index.rollback()
raise e
@@
-677,7
+672,7
@@
class Book(models.Model):
def publisher(self):
publisher = self.extra_info['publisher']
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)
return publisher
elif isinstance(publisher, list):
return ', '.join(publisher)
@@
-702,7
+697,7
@@
class Book(models.Model):
"""
books_by_parent = {}
"""
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()
if book_filter:
books = books.filter(book_filter).distinct()