Python formatting

This commit is contained in:
Mouse Reeve 2022-01-11 10:41:33 -08:00
parent 4ca90ca10f
commit 0f9881365b
2 changed files with 8 additions and 5 deletions

View file

@ -457,7 +457,11 @@ urlpatterns = [
# reading progress # reading progress
re_path(r"^edit-readthrough/?$", views.edit_readthrough, name="edit-readthrough"), re_path(r"^edit-readthrough/?$", views.edit_readthrough, name="edit-readthrough"),
re_path(r"^delete-readthrough/?$", views.delete_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), re_path(r"^delete-progressupdate/?$", views.delete_progressupdate),
# shelve actions # shelve actions
re_path( re_path(

View file

@ -118,6 +118,7 @@ class ReadingStatus(View):
@method_decorator(login_required, name="dispatch") @method_decorator(login_required, name="dispatch")
class ReadThrough(View): class ReadThrough(View):
"""Add new read dates""" """Add new read dates"""
def get(self, request, book_id, readthrough_id=None): def get(self, request, book_id, readthrough_id=None):
"""standalone form in case of errors""" """standalone form in case of errors"""
book = get_object_or_404(models.Edition, id=book_id) book = get_object_or_404(models.Edition, id=book_id)
@ -129,7 +130,6 @@ class ReadThrough(View):
) )
return TemplateResponse(request, "readthrough/readthrough.html", data) return TemplateResponse(request, "readthrough/readthrough.html", data)
def post(self, request): def post(self, request):
"""can't use the form normally because the dates are too finnicky""" """can't use the form normally because the dates are too finnicky"""
book_id = request.POST.get("book") book_id = request.POST.get("book")
@ -149,9 +149,7 @@ class ReadThrough(View):
data["readthrough"] = get_object_or_404( data["readthrough"] = get_object_or_404(
models.ReadThrough, id=request.POST.get("id") models.ReadThrough, id=request.POST.get("id")
) )
return TemplateResponse( return TemplateResponse(request, "readthrough/readthrough.html", data)
request, "readthrough/readthrough.html", data
)
form.save() form.save()
return redirect("book", book_id) return redirect("book", book_id)
@ -196,6 +194,7 @@ def delete_readthrough(request):
readthrough.delete() readthrough.delete()
return redirect(request.headers.get("Referer", "/")) return redirect(request.headers.get("Referer", "/"))
@login_required @login_required
@require_POST @require_POST
def delete_progressupdate(request): def delete_progressupdate(request):