From f86834274ea533b78b66276e2021101f795aeb69 Mon Sep 17 00:00:00 2001
From: TheJoeCoder <joe@radialbog9.uk>
Date: Wed, 31 Jul 2024 13:35:36 +0100
Subject: [PATCH] Fix CSRF token errors by passing request to render_foo table
 functions

---
 librarian/tables.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/librarian/tables.py b/librarian/tables.py
index 93c71f5..5e62fa3 100644
--- a/librarian/tables.py
+++ b/librarian/tables.py
@@ -21,9 +21,9 @@ class CopyLoanHistoryTable(tables.Table):
     returned_date = tables.Column(accessor="checked_in", verbose_name="Returned Date")
     actions = tables.Column(empty_values=())
 
-    # noinspection PyMethodMayBeStatic
+    # noinspection PyUnresolvedReferences
     def render_user(self, value, record):
-        return render_to_string("librarian/widgets/user_profile_link.html", {"user": record.user})
+        return render_to_string("librarian/widgets/user_profile_link.html", {"user": record.user}, self.request)
 
     # noinspection PyMethodMayBeStatic
     def render_due_date(self, value, record):
@@ -32,9 +32,9 @@ class CopyLoanHistoryTable(tables.Table):
         else:
             return value
 
-    # noinspection PyMethodMayBeStatic
+    # noinspection PyUnresolvedReferences
     def render_actions(self, value, record):
-        return render_to_string("librarian/widgets/actions_copy_loans.html", {"loan": record})
+        return render_to_string("librarian/widgets/actions_copy_loans.html", {"loan": record}, self.request)
 
 
 class UserLoanActiveTable(tables.Table):
@@ -63,9 +63,9 @@ class UserLoanActiveTable(tables.Table):
         else:
             return value
 
-    # noinspection PyMethodMayBeStatic
+    # noinspection PyUnresolvedReferences
     def render_actions(self, value, record):
-        return render_to_string("librarian/widgets/actions_user_loans.html", {"loan": record})
+        return render_to_string("librarian/widgets/actions_user_loans.html", {"loan": record}, self.request)
 
 
 class UserLoanHistoryTable(tables.Table):
-- 
GitLab