Fixes subjects in add edition view

This commit is contained in:
Mouse Reeve 2022-03-17 08:02:59 -07:00
parent 26f0501e2f
commit a684d86d15
3 changed files with 13 additions and 2 deletions

View file

@ -86,7 +86,6 @@ class EditionForm(CustomForm):
"ASIN": forms.TextInput(attrs={"aria-describedby": "desc_ASIN"}),
}
class EditionFromWorkForm(CustomForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

View file

@ -57,7 +57,18 @@
<form action="{% url 'create-book-data' %}" method="POST" name="add-edition-form">
{% csrf_token %}
{{ work_form }}
{{ work_form.title }}
{{ work_form.subtitle }}
{{ work_form.authors }}
{{ work_form.description }}
{{ work_form.languages }}
{{ work_form.series }}
{{ work_form.cover }}
{{ work_form.first_published_date }}
{% for subject in work.subjects %}
<input type="hidden" name="subjects" value="{{ subject }}">
{% endfor %}
<input type="hidden" name="parent_work" value="{{ work.id }}">
<div>
<button class="button is-small" type="submit">

View file

@ -219,6 +219,7 @@ def create_book_from_data(request):
book = {
"parent_work": {"id": request.POST.get("parent_work")},
"authors": models.Author.objects.filter(id__in=author_ids).all(),
"subjects": request.POST.getlist("subjects"),
}
data = {"book": book, "form": forms.EditionForm(request.POST)}