+class BookDetails(object):
+ """Custom fields used for representing Books."""
+
+ @classmethod
+ def author(cls, book):
+ return ", ".join(t.name for t in book.tags.filter(category='author'))
+
+ @classmethod
+ def href(cls, book):
+ """ Returns an URI for a Book in the API. """
+ return API_BASE + reverse("api_book", args=[book.slug])
+
+ @classmethod
+ def url(cls, book):
+ """ Returns Book's URL on the site. """
+
+ return WL_BASE + book.get_absolute_url()
+
+ @classmethod
+ def children(cls, book):
+ """ Returns all media for a book. """
+
+ return book.children.all()
+
+ @classmethod
+ def media(cls, book):
+ """ Returns all media for a book. """
+
+ return book.media.all()
+