1
0
Fork 0

ActivityPub serialize book

This commit is contained in:
Mouse Reeve 2020-03-27 19:52:05 -07:00
parent 0557a5cc69
commit 5c475e448a
5 changed files with 68 additions and 4 deletions

View file

@ -309,6 +309,9 @@ def book_page(request, book_identifier, tab='friends'):
''' info about a book '''
book = books_manager.get_or_create_book(book_identifier)
if is_api_request(request):
return JsonResponse(activitypub.get_book(book))
if isinstance(book, models.Work):
book_reviews = models.Review.objects.filter(
Q(book=book) | Q(book__parent_work=book),
@ -426,6 +429,10 @@ def shelf_page(request, username, shelf_identifier):
return HttpResponseNotFound()
shelf = models.Shelf.objects.get(user=user, identifier=shelf_identifier)
if is_api_request(request):
return activitypub.get_shelf(shelf)
data = {
'shelf': shelf,
'user': user,