Skip to content

Commit

Permalink
Revert "fix(socialaccount): is_existing caused repeated db queries"
Browse files Browse the repository at this point in the history
This reverts commit 2021e0b.
  • Loading branch information
pennersr committed Jul 30, 2024
1 parent 53a36b5 commit 2cc8f19
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions allauth/socialaccount/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,28 +296,14 @@ def save(self, request, connect: bool = False) -> None:
else:
setup_user_email(request, user, self.email_addresses)

@property
def user(self):
return self._user

@user.setter
def user(self, v):
self._user = v
self._is_existing = None

@property
def is_existing(self) -> bool:
"""When `False`, this social login represents a temporary account, not
yet backed by a database record.
"""
if self._is_existing is not None:
return self._is_existing
if self.user.pk is None:
ret = False
else:
ret = get_user_model().objects.filter(pk=self.user.pk).exists()
self._is_existing = ret
return ret
return False
return get_user_model().objects.filter(pk=self.user.pk).exists()

def lookup(self) -> None:
"""Look up the existing local user account to which this social login
Expand Down

0 comments on commit 2cc8f19

Please sign in to comment.