Standardize JS, use button, & filter empty authors

This commit is contained in:
Chad Nelson
2021-11-30 17:21:28 -05:00
parent 6be9ac4f70
commit 66e414be3c
3 changed files with 13 additions and 4 deletions

View File

@ -43,8 +43,8 @@ class EditBook(View):
if not form.is_valid():
return TemplateResponse(request, "book/edit/edit_book.html", data)
add_author = request.POST.getlist("add_author")
# we're adding an author through a free text field
# filter out empty author fields
add_author = [author for author in request.POST.getlist("add_author") if author]
if add_author:
data["add_author"] = add_author
data["author_matches"] = []