old_contents: from django.shortcuts import redirect
  from django.views.decorators.csrf import csrf_exempt
  from .models import BookIndex, Book
  
  
  @csrf_exempt
  def book_index(request):
      page = BookIndex.objects.all()[0]
      return redirect('/api/v2/pages/{}'.format(page.pk))
  
  
  @csrf_exempt
  def book_detail(request, slug):
      try:
          page = Book.objects.get(slug=slug)
          return redirect('/api/v2/pages/{}'.format(page.pk))
      except Book.DoesNotExist:
          #no book, return to book index
          page = BookIndex.objects.all()[0]
          return redirect('/api/v2/pages/{}'.format(page.pk))
  
new_contents: from django.shortcuts import redirect
  from django.http import Http404
  from django.views.decorators.csrf import csrf_exempt
  from .models import BookIndex, Book
  
  
  @csrf_exempt
  def book_index(request):
      page = BookIndex.objects.all()[0]
      return redirect('/api/v2/pages/{}'.format(page.pk))
  
  
  @csrf_exempt
  def book_detail(request, slug):
      try:
          page = Book.objects.get(slug=slug)
          return redirect('/api/v2/pages/{}'.format(page.pk))
      except Book.DoesNotExist:
          raise Http404("Book does not exist.")
  
subject: return 404 if book slug does not exist