forked from mirrors/bookwyrm
View for starting to edit a book with existing data
This commit is contained in:
parent
f1f7b21d43
commit
6d1d62cf2f
1 changed files with 10 additions and 0 deletions
|
@ -9,6 +9,7 @@ from django.shortcuts import get_object_or_404, redirect
|
|||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDictKeyError
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.http import require_POST
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import book_search, forms, models
|
||||
|
@ -145,6 +146,15 @@ class EditBook(View):
|
|||
return redirect(f"/book/{book.id}")
|
||||
|
||||
|
||||
@require_POST
|
||||
@permission_required("bookwyrm.edit_book", raise_exception=True)
|
||||
def create_book_from_data(request):
|
||||
"""create a book with starter data"""
|
||||
data = {"form": forms.EditionForm(request.POST)}
|
||||
return TemplateResponse(request, "book/edit/edit_book.html", data)
|
||||
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
@method_decorator(
|
||||
permission_required("bookwyrm.edit_book", raise_exception=True), name="dispatch"
|
||||
|
|
Loading…
Reference in a new issue