Show shelf buttons appropriate for current user.

This commit is contained in:
Adam Kelly 2020-03-27 14:50:38 +00:00
parent ea735fd570
commit 778ce91f91

View file

@ -84,7 +84,7 @@ def shelve_button_identifier(context, book):
''' check what shelf a user has a book on, if any ''' ''' check what shelf a user has a book on, if any '''
try: try:
shelf = models.ShelfBook.objects.get( shelf = models.ShelfBook.objects.get(
shelf__user=context['user'], shelf__user=context['request'].user,
book=book book=book
) )
except models.ShelfBook.DoesNotExist: except models.ShelfBook.DoesNotExist:
@ -102,7 +102,7 @@ def shelve_button_text(context, book):
''' check what shelf a user has a book on, if any ''' ''' check what shelf a user has a book on, if any '''
try: try:
shelf = models.ShelfBook.objects.get( shelf = models.ShelfBook.objects.get(
shelf__user=context['user'], shelf__user=context['request'].user,
book=book book=book
) )
except models.ShelfBook.DoesNotExist: except models.ShelfBook.DoesNotExist: