From 215a7f197110ae00d624eb3ec8ea7c423ac534c7 Mon Sep 17 00:00:00 2001
From: beckerfy <fynn.becker@hs-hannover.de>
Date: Thu, 23 Jul 2020 15:53:26 +0200
Subject: [PATCH] Fix django autofetch

---
 postgrestutils/_django_utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/postgrestutils/_django_utils.py b/postgrestutils/_django_utils.py
index b08afc7..b552a1c 100644
--- a/postgrestutils/_django_utils.py
+++ b/postgrestutils/_django_utils.py
@@ -30,8 +30,8 @@ def autofetch(sender, **kwargs):
     else:
         payload['auth_provider_uid'] = 'eq.{}'.format(kwargs['user'].sso_mapping.uuid)
 
-    with postgrestutils.conn() as c:
-        account = c.get('account', params=payload)
+    with postgrestutils.Session() as s:
+        account = s.get('account', params=payload)
     user_account_fetched.send(sender=None, request=kwargs['request'], account=account)
 
 
-- 
GitLab