From 220cad866196696c8182ac966327b300ae42728a Mon Sep 17 00:00:00 2001 From: Joeri de Ruiter Date: Tue, 1 Aug 2023 15:12:50 +0200 Subject: [PATCH] Only show author confirmation if new authors are added, show suggestions for parent work and set it correctly. --- bookwyrm/forms/books.py | 1 + bookwyrm/templates/book/edit/edit_book.html | 4 ++-- bookwyrm/templates/book/edit/edit_book_form.html | 2 ++ bookwyrm/templates/book/editions/editions.html | 1 + bookwyrm/views/books/edit_book.py | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bookwyrm/forms/books.py b/bookwyrm/forms/books.py index 3a3979e2ca..4885dc0632 100644 --- a/bookwyrm/forms/books.py +++ b/bookwyrm/forms/books.py @@ -111,6 +111,7 @@ class Meta: model = models.Work fields = [ "title", + "sort_title", "subtitle", "authors", "description", diff --git a/bookwyrm/templates/book/edit/edit_book.html b/bookwyrm/templates/book/edit/edit_book.html index d4ca2165df..05f40523ff 100644 --- a/bookwyrm/templates/book/edit/edit_book.html +++ b/bookwyrm/templates/book/edit/edit_book.html @@ -111,11 +111,11 @@

{% trans "Confirm Book Info" %}

{% endif %} {% endfor %} - {% else %} + {% elif add_author %}

{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% endblocktrans %}

{% endif %} - {% if not book %} + {% if not book.parent_work %}
diff --git a/bookwyrm/templates/book/edit/edit_book_form.html b/bookwyrm/templates/book/edit/edit_book_form.html index 72d80e9cf7..23cc6d097d 100644 --- a/bookwyrm/templates/book/edit/edit_book_form.html +++ b/bookwyrm/templates/book/edit/edit_book_form.html @@ -10,7 +10,9 @@ {% csrf_token %} +{% if form.parent_work %} +{% endif %}
diff --git a/bookwyrm/templates/book/editions/editions.html b/bookwyrm/templates/book/editions/editions.html index 16f65e4597..aa2b68bdb5 100644 --- a/bookwyrm/templates/book/editions/editions.html +++ b/bookwyrm/templates/book/editions/editions.html @@ -58,6 +58,7 @@

{% csrf_token %} {{ work_form.title }} + {{ work_form.sort_title }} {{ work_form.subtitle }} {{ work_form.authors }} {{ work_form.description }} diff --git a/bookwyrm/views/books/edit_book.py b/bookwyrm/views/books/edit_book.py index f732f88867..2a7f36dbb7 100644 --- a/bookwyrm/views/books/edit_book.py +++ b/bookwyrm/views/books/edit_book.py @@ -157,6 +157,7 @@ def add_authors(request, data): """helper for adding authors""" add_author = [author for author in request.POST.getlist("add_author") if author] if not add_author: + data["add_author"] = [] return data data["add_author"] = add_author