Merge pull request #2937 from jderuiter/create-book-fixes

Fixes for create-book
This commit is contained in:
Mouse Reeve 2023-08-01 19:02:33 -07:00 committed by GitHub
commit 173d0b77ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 2 deletions

View file

@ -111,6 +111,7 @@ class EditionFromWorkForm(CustomForm):
model = models.Work
fields = [
"title",
"sort_title",
"subtitle",
"authors",
"description",

View file

@ -111,11 +111,11 @@
{% endif %}
{% endfor %}
</div>
{% else %}
{% elif add_author %}
<p class="column is-half">{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% endblocktrans %}</p>
{% endif %}
{% if not book %}
{% if not book.parent_work %}
<div class="column is-half">
<fieldset>
<legend class="title is-5 mb-1">

View file

@ -10,7 +10,9 @@
{% csrf_token %}
<input type="hidden" name="last_edited_by" value="{{ request.user.id }}">
{% if form.parent_work %}
<input type="hidden" name="parent_work" value="{% firstof book.parent_work.id form.parent_work %}">
{% endif %}
<div class="columns">
<div class="column is-half">

View file

@ -58,6 +58,7 @@
<form action="{% url 'create-book-data' %}" method="POST" name="add-edition-form">
{% csrf_token %}
{{ work_form.title }}
{{ work_form.sort_title }}
{{ work_form.subtitle }}
{{ work_form.authors }}
{{ work_form.description }}

View file

@ -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