From 0f9881365b4f0c150fb0d75f60ce5bc6354fd494 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 11 Jan 2022 10:41:33 -0800 Subject: [PATCH] Python formatting --- bookwyrm/urls.py | 6 +++++- bookwyrm/views/reading.py | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index ae67c0920..7a95103df 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -457,7 +457,11 @@ urlpatterns = [ # reading progress re_path(r"^edit-readthrough/?$", views.edit_readthrough, name="edit-readthrough"), re_path(r"^delete-readthrough/?$", views.delete_readthrough), - re_path(r"^create-readthrough/?$", views.ReadThrough.as_view(), name="create-readthrough"), + re_path( + r"^create-readthrough/?$", + views.ReadThrough.as_view(), + name="create-readthrough", + ), re_path(r"^delete-progressupdate/?$", views.delete_progressupdate), # shelve actions re_path( diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index a5d69947e..d90c0e9dc 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -118,6 +118,7 @@ class ReadingStatus(View): @method_decorator(login_required, name="dispatch") class ReadThrough(View): """Add new read dates""" + def get(self, request, book_id, readthrough_id=None): """standalone form in case of errors""" book = get_object_or_404(models.Edition, id=book_id) @@ -129,7 +130,6 @@ class ReadThrough(View): ) return TemplateResponse(request, "readthrough/readthrough.html", data) - def post(self, request): """can't use the form normally because the dates are too finnicky""" book_id = request.POST.get("book") @@ -149,9 +149,7 @@ class ReadThrough(View): data["readthrough"] = get_object_or_404( models.ReadThrough, id=request.POST.get("id") ) - return TemplateResponse( - request, "readthrough/readthrough.html", data - ) + return TemplateResponse(request, "readthrough/readthrough.html", data) form.save() return redirect("book", book_id) @@ -196,6 +194,7 @@ def delete_readthrough(request): readthrough.delete() return redirect(request.headers.get("Referer", "/")) + @login_required @require_POST def delete_progressupdate(request):