diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index 585d77db2..99e95ddbd 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -56,14 +56,12 @@ class ReadingStatus(View): ) # gets the first shelf that indicates a reading status, or None - current_status_shelfbook = next( - iter( - s - for s in book.current_shelves - if s.shelf.identifier in models.Shelf.READ_STATUS_IDENTIFIERS - ), - None, - ) + shelves = [ + s + for s in book.current_shelves + if s.shelf.identifier in models.Shelf.READ_STATUS_IDENTIFIERS + ] + current_status_shelfbook = shelves[0] if shelves else None # checking the referer prevents redirecting back to the modal page referer = request.headers.get("Referer", "/")