From 778ce91f9167fb641eac9483776a10170e7fabe1 Mon Sep 17 00:00:00 2001 From: Adam Kelly Date: Fri, 27 Mar 2020 14:50:38 +0000 Subject: [PATCH 1/2] Show shelf buttons appropriate for current user. --- fedireads/templatetags/fr_display.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fedireads/templatetags/fr_display.py b/fedireads/templatetags/fr_display.py index b34fc9f64..b3c4ad803 100644 --- a/fedireads/templatetags/fr_display.py +++ b/fedireads/templatetags/fr_display.py @@ -84,7 +84,7 @@ def shelve_button_identifier(context, book): ''' check what shelf a user has a book on, if any ''' try: shelf = models.ShelfBook.objects.get( - shelf__user=context['user'], + shelf__user=context['request'].user, book=book ) 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 ''' try: shelf = models.ShelfBook.objects.get( - shelf__user=context['user'], + shelf__user=context['request'].user, book=book ) except models.ShelfBook.DoesNotExist: From 5945ddcd7500c0b1062dfc9e0789c902b8df4383 Mon Sep 17 00:00:00 2001 From: Adam Kelly Date: Fri, 27 Mar 2020 15:36:57 +0000 Subject: [PATCH 2/2] Add shelve button to the book page. --- fedireads/templates/book.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fedireads/templates/book.html b/fedireads/templates/book.html index 078526832..35df71127 100644 --- a/fedireads/templates/book.html +++ b/fedireads/templates/book.html @@ -21,6 +21,8 @@ + {% include 'snippets/shelve_button.html' %} +