force page reload when adding status from move button

This commit is contained in:
Hugh Rundle 2021-11-20 14:59:59 +11:00
parent 41862e854c
commit af9768a2e3
No known key found for this signature in database
GPG key ID: CD23D6039184286B

View file

@ -117,12 +117,16 @@ class CreateStatus(View):
status.save(created=created)
# update a readthorugh, if needed
# update a readthrough, if needed
try:
edit_readthrough(request)
except Http404:
pass
# force page reload if this was triggered from 'move' button
if bool(request.POST.get("shelf")):
return HttpResponse(headers={"forceReload" : "true"})
if is_api_request(request):
return HttpResponse()
return redirect("/")
@ -157,6 +161,8 @@ def update_progress(request, book_id): # pylint: disable=unused-argument
@require_POST
def edit_readthrough(request):
"""can't use the form because the dates are too finnicky"""
# BUG when triggering finish reading with comments and no previous readthroughs
# this will 404
readthrough = get_object_or_404(models.ReadThrough, id=request.POST.get("id"))
readthrough.raise_not_editable(request.user)