From 79d9c493f7fcc8b64d9e3c878f8358f331c29d11 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 7 Mar 2021 14:19:22 -0800 Subject: [PATCH] Remove author flow --- bookwyrm/templates/edit_book.html | 14 ++++++++------ bookwyrm/views/books.py | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bookwyrm/templates/edit_book.html b/bookwyrm/templates/edit_book.html index dc927e8a..a4d62efd 100644 --- a/bookwyrm/templates/edit_book.html +++ b/bookwyrm/templates/edit_book.html @@ -103,12 +103,14 @@

{% trans "Authors" %}

- {% for author in book.authors.all %} -

{{ author.name }} - - {% endfor %} +

+ {% for author in book.authors.all %} +

{{ author.name }} + + {% endfor %} +

{% if confirm_mode %} {% else %} diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index 0097eb9f..cc05a79c 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -163,6 +163,10 @@ class EditBook(View): data['confirm_mode'] = True return TemplateResponse(request, 'edit_book.html', data) + remove_authors = request.POST.getlist('remove_authors') + for author_id in remove_authors: + book.authors.remove(author_id) + book = form.save() return redirect('/book/%s' % book.id)