this error happens when i login in using social auth that connect with customuser model .
/accounts/google/login/callback/ CustomUser matching query does not exist. raise self.model.DoesNotExist( user_api.models.CustomUser.DoesNotExist: CustomUser matching query does not exist. [03/Apr/2023 04:43:51] "GET /accounts/google/login/callback/?state=hIP4XQIEu2T0&code=4%2F0AVHEtk7BhqZS4My4nw1gCkXyHmraxoHaFNZIg_s6Rht5bP7mK8nIhn2iw_2RDn1KmVi9iw&scope=email+profile+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&authuser=0&prompt=none HTTP/1.1" 500 107611
models.py
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.db import models
from django.utils import timezone
from allauth.socialaccount.models import SocialAccount
from django.contrib.auth import get_user_model
from allauth.socialaccount.models import SocialAccount
from django.contrib.auth.models import AbstractUser
from django.db import models
from datetime import datetime ,timedelta
""" set the subscription to end in 30 days"""
sub_expiration=datetime.now()+timedelta(days=30)
class CustomUser(AbstractUser):
subscription_date = models.DateTimeField(default=sub_expiration,null=True, blank=True)
social_account= models.ForeignKey(SocialAccount, on_delete=models.CASCADE,null=True, related_name='usersocial')
groups = models.ManyToManyField(
'auth.Group',
blank=True,
related_name='customuser_set',
related_query_name='customuser',
)
user_permissions = models.ManyToManyField(
'auth.Permission',
blank=True,
related_name='customuser_set',
related_query_name='customuser',
)
@property
def auth_source(self):
auth_source = self.social_account.provider
return auth_source
@property
def auth_id(self):
auth_id = self.social_account.uid
return auth_id
settings.py
AUTH_USER_MODEL = 'user_api.CustomUser'
when I am using the default user, I did not get the error, another thing when I remove the social account the errors go away but I can not add the property that I need in my custom user. thank you in advanceenter image description here.