+ @classmethod
+ def cover_color(cls, book):
+ return WLCover.epoch_colors.get(book.extra_info.get('epoch'), '#000000')
+
+ @classmethod
+ def full_sort_key(cls, book):
+ return '%s%s%s%s%s' % (book.sort_key_author, SORT_KEY_SEP, book.sort_key, SORT_KEY_SEP, book.id)
+
+ @staticmethod
+ def books_after(books, after, new_api):
+ if not new_api:
+ return books.filter(slug__gt=after)
+ try:
+ author, title, book_id = after.split(SORT_KEY_SEP)
+ except ValueError:
+ return Book.objects.none()
+ return books.filter(Q(sort_key_author__gt=author)
+ | (Q(sort_key_author=author) & Q(sort_key__gt=title))
+ | (Q(sort_key_author=author) & Q(sort_key=title) & Q(id__gt=int(book_id))))
+
+ @staticmethod
+ def order_books(books, new_api):
+ if new_api:
+ return books.order_by('sort_key_author', 'sort_key', 'id')
+ else:
+ return books.order_by('slug')
+