mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Fixed an issue where not being logged in would fail favorites check
This commit is contained in:
4
src/interface/templates/index.html
vendored
4
src/interface/templates/index.html
vendored
@@ -39,9 +39,9 @@
|
||||
<li class="nav_menu_tab"><i class="fas fa-bug"></i> Bug report</li>
|
||||
<li class="nav_menu_tab" id="btn_login"> <i class="fa fa-user-circle" aria-hidden="true"></i>
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href='logout' class='nav_link'> {{ request.user }}</a>
|
||||
<a href='/logout' class='nav_link'> {{ request.user }}</a>
|
||||
{% else %}
|
||||
<a href="login" class='nav_link'> Login</a>
|
||||
<a href="/login" class='nav_link'> Login</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</div>
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user