Fixes urls in edit book form

This commit is contained in:
Mouse Reeve 2022-05-19 09:32:01 -07:00
parent cbd43c42a9
commit 6d7bb33683
2 changed files with 20 additions and 4 deletions

View file

@ -41,10 +41,18 @@
class="block" class="block"
{% if book.id %} {% if book.id %}
name="edit-book" 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 %} {% else %}
name="create-book" 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 %} {% endif %}
method="post" method="post"
enctype="multipart/form-data" enctype="multipart/form-data"

View file

@ -537,12 +537,20 @@ urlpatterns = [
name="book-user-statuses", name="book-user-statuses",
), ),
re_path(rf"{BOOK_PATH}/edit/?$", views.EditBook.as_view(), name="edit-book"), 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( re_path(
r"^create-book/data/?$", views.create_book_from_data, name="create-book-data" 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/?$", 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(rf"{BOOK_PATH}/editions(.json)?/?$", views.Editions.as_view()),
re_path( re_path(
r"^upload-cover/(?P<book_id>\d+)/?$", views.upload_cover, name="upload-cover" r"^upload-cover/(?P<book_id>\d+)/?$", views.upload_cover, name="upload-cover"