fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error handling.
[redakcja.git]
/
src
/
depot
/
views.py
diff --git
a/src/depot/views.py
b/src/depot/views.py
index
5e468b6
..
7976086
100644
(file)
--- a/
src/depot/views.py
+++ b/
src/depot/views.py
@@
-5,13
+5,14
@@
from documents.models import Book
from . import models
from . import models
-class
Legimi
PublishView(PermissionRequiredMixin, View):
- permission_required = 'depot.add_
legimi
bookpublish'
+class
Shop
PublishView(PermissionRequiredMixin, View):
+ permission_required = 'depot.add_
shop
bookpublish'
- def post(self, request, book_id):
+ def post(self, request, shop_id, book_id):
+ shop = get_object_or_404(models.Shop, pk=shop_id)
book = get_object_or_404(Book, pk=book_id)
try:
book = get_object_or_404(Book, pk=book_id)
try:
- publish = models.
LegimiBookPublish.create_for(book, request.user
)
+ publish = models.
ShopBookPublish.create_for(book, request.user, shop
)
except AssertionError:
pass
return redirect(book.get_absolute_url())
except AssertionError:
pass
return redirect(book.get_absolute_url())