social-core
social-core copied to clipboard
How to use my custom model and not the Django user model?
Hi,
I want use my custom model: https://github.com/paulocoutinhox/pyaa/blob/main/account/models.py#L17
Instead of Django user model.
But, only for "site" auth/login and not for the "admin".
The "admin" i want the default things with user model.
What i need do?
I already implement the create pipeline and it is creating:
import uuid
from language.models import Language
from main import settings
from ..enums import CustomerStatus
from ..models import Customer
def create_user(strategy, details, backend, user=None, *args, **kwargs):
if user:
return {"is_new": False}
else:
is_new = True
email = details.get("email")
try:
customer = Customer.objects.get(email=email)
except Customer.DoesNotExist:
language = Language.objects.first()
customer = Customer(
name=details.get("fullname", ""),
email=email,
language=language,
status=CustomerStatus.ACTIVE,
timezone=settings.DEFAULT_TIME_ZONE,
)
customer.setup_password_data(password=str(uuid.uuid4()))
customer.setup_initial_data()
customer.save()
return {"is_new": is_new, "user": customer}
But i need now the association and the other things.
What i need do?
Thanks.