code style

This commit is contained in:
Hugh Rundle
2021-11-20 16:06:16 +11:00
parent 12810d8e34
commit b273123708
5 changed files with 15 additions and 9 deletions

View File

@ -91,17 +91,18 @@ class ReadingStatus(View):
handle_reading_status(request.user, desired_shelf, book, privacy)
# if the request includes a "shelf" value we are using the 'move' button
if bool(request.POST.get("shelf")):
if bool(request.POST.get("shelf")):
# unshelve the existing shelf
this_shelf = request.POST.get("shelf")
if (
bool(current_status_shelfbook) and
int(this_shelf) != int(current_status_shelfbook.shelf.id) and
current_status_shelfbook.shelf.identifier != desired_shelf.identifier
):
bool(current_status_shelfbook)
and int(this_shelf) != int(current_status_shelfbook.shelf.id)
and current_status_shelfbook.shelf.identifier
!= desired_shelf.identifier
):
return unshelve(request, referer=referer, book_id=book_id)
# don't try to unshelve a read status shelf: it has already been deleted.
return HttpResponse(headers={"forceReload" : "true"})
return HttpResponse(headers={"forceReload": "true"})
if is_api_request(request):
return HttpResponse()

View File

@ -102,5 +102,5 @@ def unshelve(request, referer=None, book_id=False):
shelf_book.raise_not_deletable(request.user)
shelf_book.delete()
if bool(referer):
return HttpResponse(headers={"forceReload" : "true"})
return HttpResponse(headers={"forceReload": "true"})
return redirect(request.headers.get("Referer", "/"))

View File

@ -126,7 +126,7 @@ class CreateStatus(View):
# force page reload if this was triggered from 'move' button
if bool(request.POST.get("shelf")):
return HttpResponse(headers={"forceReload" : "true"})
return HttpResponse(headers={"forceReload": "true"})
if is_api_request(request):
return HttpResponse()