1 from django.contrib.auth.mixins import PermissionRequiredMixin
2 from django.shortcuts import get_object_or_404, redirect
3 from django.views import View
4 from documents.models import Book
8 class LegimiPublishView(PermissionRequiredMixin, View):
9 permission_required = 'depot.add_legimibookpublish'
11 def post(self, request, book_id):
12 book = get_object_or_404(Book, pk=book_id)
14 publish = models.LegimiBookPublish.create_for(book, request.user)
15 except AssertionError:
17 return redirect(book.get_absolute_url())