mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Moves book templates into dir
This commit is contained in:
parent
1ad7d88cc8
commit
4e55018e41
4 changed files with 8 additions and 8 deletions
|
@ -43,10 +43,10 @@
|
|||
{% if request.user.is_authenticated and not book.cover %}
|
||||
<div class="box p-2">
|
||||
<h3 class="title is-6 mb-1">{% trans "Add cover" %}</h3>
|
||||
<form name="add-cover" method="POST" action="/upload-cover/{{ book.id }}" enctype="multipart/form-data">
|
||||
<form name="add-cover" method="POST" action="{% url 'upload-cover' book.id %}" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<label class="label">
|
||||
<input type="file" name="cover" accept="image/*" enctype="multipart/form-data" id="id_cover" required>
|
||||
<input type="file" name="cover" accept="image/*" enctype="multipart/form-data" id="id_cover">
|
||||
</label>
|
||||
<button class="button is-small is-primary" type="submit">{% trans "Add" %}</button>
|
||||
</form>
|
|
@ -152,7 +152,7 @@ urlpatterns = [
|
|||
re_path(r"^create-book/?$", views.EditBook.as_view()),
|
||||
re_path(r"^create-book/confirm?$", views.ConfirmEditBook.as_view()),
|
||||
re_path(r"%s/editions(.json)?/?$" % book_path, views.Editions.as_view()),
|
||||
re_path(r"^upload-cover/(?P<book_id>\d+)/?$", views.upload_cover),
|
||||
re_path(r"^upload-cover/(?P<book_id>\d+)/?$", views.upload_cover, name="upload-cover"),
|
||||
re_path(r"^add-description/(?P<book_id>\d+)/?$", views.add_description),
|
||||
re_path(r"^resolve-book/?$", views.resolve_book),
|
||||
re_path(r"^switch-edition/?$", views.switch_edition),
|
||||
|
|
|
@ -97,7 +97,7 @@ class Book(View):
|
|||
"readthroughs": readthroughs,
|
||||
"path": "/book/%s" % book_id,
|
||||
}
|
||||
return TemplateResponse(request, "book.html", data)
|
||||
return TemplateResponse(request, "book/book.html", data)
|
||||
|
||||
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
|
@ -115,7 +115,7 @@ class EditBook(View):
|
|||
if not book.description:
|
||||
book.description = book.parent_work.description
|
||||
data = {"book": book, "form": forms.EditionForm(instance=book)}
|
||||
return TemplateResponse(request, "edit_book.html", data)
|
||||
return TemplateResponse(request, "book/edit_book.html", data)
|
||||
|
||||
def post(self, request, book_id=None):
|
||||
""" edit a book cool """
|
||||
|
@ -125,7 +125,7 @@ class EditBook(View):
|
|||
|
||||
data = {"book": book, "form": form}
|
||||
if not form.is_valid():
|
||||
return TemplateResponse(request, "edit_book.html", data)
|
||||
return TemplateResponse(request, "book/edit_book.html", data)
|
||||
|
||||
add_author = request.POST.get("add_author")
|
||||
# we're adding an author through a free text field
|
||||
|
@ -169,7 +169,7 @@ class EditBook(View):
|
|||
data["confirm_mode"] = True
|
||||
# this isn't preserved because it isn't part of the form obj
|
||||
data["remove_authors"] = request.POST.getlist("remove_authors")
|
||||
return TemplateResponse(request, "edit_book.html", data)
|
||||
return TemplateResponse(request, "book/edit_book.html", data)
|
||||
|
||||
remove_authors = request.POST.getlist("remove_authors")
|
||||
for author_id in remove_authors:
|
||||
|
@ -194,7 +194,7 @@ class ConfirmEditBook(View):
|
|||
|
||||
data = {"book": book, "form": form}
|
||||
if not form.is_valid():
|
||||
return TemplateResponse(request, "edit_book.html", data)
|
||||
return TemplateResponse(request, "book/edit_book.html", data)
|
||||
|
||||
with transaction.atomic():
|
||||
# save book
|
||||
|
|
Loading…
Reference in a new issue