Only show author confirmation if new authors are added, show suggestions for parent work and set it correctly.
This commit is contained in:
parent
07aca2f62c
commit
220cad8661
5 changed files with 7 additions and 2 deletions
|
@ -111,6 +111,7 @@ class EditionFromWorkForm(CustomForm):
|
||||||
model = models.Work
|
model = models.Work
|
||||||
fields = [
|
fields = [
|
||||||
"title",
|
"title",
|
||||||
|
"sort_title",
|
||||||
"subtitle",
|
"subtitle",
|
||||||
"authors",
|
"authors",
|
||||||
"description",
|
"description",
|
||||||
|
|
|
@ -111,11 +111,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% elif add_author %}
|
||||||
<p class="column is-half">{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% endblocktrans %}</p>
|
<p class="column is-half">{% blocktrans with name=add_author %}Creating a new author: {{ name }}{% endblocktrans %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not book %}
|
{% if not book.parent_work %}
|
||||||
<div class="column is-half">
|
<div class="column is-half">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="title is-5 mb-1">
|
<legend class="title is-5 mb-1">
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
<input type="hidden" name="last_edited_by" value="{{ request.user.id }}">
|
<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 %}">
|
<input type="hidden" name="parent_work" value="{% firstof book.parent_work.id form.parent_work %}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-half">
|
<div class="column is-half">
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
<form action="{% url 'create-book-data' %}" method="POST" name="add-edition-form">
|
<form action="{% url 'create-book-data' %}" method="POST" name="add-edition-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ work_form.title }}
|
{{ work_form.title }}
|
||||||
|
{{ work_form.sort_title }}
|
||||||
{{ work_form.subtitle }}
|
{{ work_form.subtitle }}
|
||||||
{{ work_form.authors }}
|
{{ work_form.authors }}
|
||||||
{{ work_form.description }}
|
{{ work_form.description }}
|
||||||
|
|
|
@ -157,6 +157,7 @@ def add_authors(request, data):
|
||||||
"""helper for adding authors"""
|
"""helper for adding authors"""
|
||||||
add_author = [author for author in request.POST.getlist("add_author") if author]
|
add_author = [author for author in request.POST.getlist("add_author") if author]
|
||||||
if not add_author:
|
if not add_author:
|
||||||
|
data["add_author"] = []
|
||||||
return data
|
return data
|
||||||
|
|
||||||
data["add_author"] = add_author
|
data["add_author"] = add_author
|
||||||
|
|
Loading…
Add table
Reference in a new issue