From 6d7bb336838d0fae953a76e2b0d6506eac1ab0c0 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 19 May 2022 09:32:01 -0700 Subject: [PATCH] Fixes urls in edit book form --- bookwyrm/templates/book/edit/edit_book.html | 12 ++++++++++-- bookwyrm/urls.py | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/bookwyrm/templates/book/edit/edit_book.html b/bookwyrm/templates/book/edit/edit_book.html index b088c1e87..e5b865b55 100644 --- a/bookwyrm/templates/book/edit/edit_book.html +++ b/bookwyrm/templates/book/edit/edit_book.html @@ -41,10 +41,18 @@ class="block" {% if book.id %} name="edit-book" - action="{{ book.local_path }}/{% if confirm_mode %}confirm{% else %}edit{% endif %}" + {% if confirm_mode %} + action="{% url 'edit-book-confirm' book.id %}" + {% else %} + action="{% url 'edit-book' book.id %}" + {% endif %} {% else %} name="create-book" - action="/create-book{% if confirm_mode %}/confirm{% endif %}" + {% if confirm_mode %} + action="{% url 'create-book-confirm' %}" + {% else %} + action="{% url 'create-book' %}" + {% endif %} {% endif %} method="post" enctype="multipart/form-data" diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 9b2b68f1b..bb4cbbe2e 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -537,12 +537,20 @@ urlpatterns = [ name="book-user-statuses", ), re_path(rf"{BOOK_PATH}/edit/?$", views.EditBook.as_view(), name="edit-book"), - re_path(rf"{BOOK_PATH}/confirm/?$", views.ConfirmEditBook.as_view()), + re_path( + rf"{BOOK_PATH}/confirm/?$", + views.ConfirmEditBook.as_view(), + name="edit-book-confirm", + ), re_path( r"^create-book/data/?$", views.create_book_from_data, name="create-book-data" ), re_path(r"^create-book/?$", views.CreateBook.as_view(), name="create-book"), - re_path(r"^create-book/confirm/?$", views.ConfirmEditBook.as_view()), + re_path( + r"^create-book/confirm/?$", + views.ConfirmEditBook.as_view(), + name="create-book-confirm", + ), re_path(rf"{BOOK_PATH}/editions(.json)?/?$", views.Editions.as_view()), re_path( r"^upload-cover/(?P\d+)/?$", views.upload_cover, name="upload-cover"