X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/db255ed9d242c56b010061fbdef8de9b696869d4..37f3ee92951cdf0d9742b37a5a5f839675b996ff:/src/depot/views.py?ds=inline diff --git a/src/depot/views.py b/src/depot/views.py index 5e468b67..5236adcf 100644 --- a/src/depot/views.py +++ b/src/depot/views.py @@ -5,13 +5,14 @@ from documents.models import Book from . import models -class LegimiPublishView(PermissionRequiredMixin, View): - permission_required = 'depot.add_legimibookpublish' +class SitePublishView(PermissionRequiredMixin, View): + permission_required = 'depot.add_sitebookpublish' - def post(self, request, book_id): + def post(self, request, site_id, book_id): + site = get_object_or_404(models.Site, pk=site_id) book = get_object_or_404(Book, pk=book_id) try: - publish = models.LegimiBookPublish.create_for(book, request.user) + publish = models.SiteBookPublish.create_for(book, request.user, site) except AssertionError: pass return redirect(book.get_absolute_url())