From 5aeb7ff13cb99bdf979574b656e842253dfc75d4 Mon Sep 17 00:00:00 2001 From: Raelon Masters Date: Tue, 21 Jul 2020 23:55:44 -0400 Subject: [PATCH] Fixed an issue where not being logged in would fail favorites check --- src/interface/templates/index.html | 4 ++-- src/interface/views.py | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/interface/templates/index.html b/src/interface/templates/index.html index af992a1..108ea25 100755 --- a/src/interface/templates/index.html +++ b/src/interface/templates/index.html @@ -39,9 +39,9 @@ diff --git a/src/interface/views.py b/src/interface/views.py index 60e14e2..a920cc4 100755 --- a/src/interface/views.py +++ b/src/interface/views.py @@ -51,7 +51,6 @@ def signup(request): def userlogin(request): if request.method == 'POST': - breakpoint() username = request.POST['username'] password = request.POST['password'] user = authenticate(request, username=username, password=password) @@ -167,14 +166,14 @@ def book_set(request, _order, _limit=None, _set=1, _flip=False): books = Books.objects.all().order_by(_order)[_set_min:_set_max] try: favorites = Favorites.objects.filter(user=request.user) - except Exception as e: breakpoint() - for book in books: - for favorite in favorites: - if book == favorite.book: - book.is_favorite = True - break - else: book.is_favorite = False - return books + for book in books: + for favorite in favorites: + if book == favorite.book: + book.is_favorite = True + break + return books + except Exception as e: + return books def collection(_collection, _set, _limit=None):