User

class User(AbstractUser):
    """
    Users within the Django authentication system are represented by this
    model.

    Username and password are required. Other fields are optional.
    """

    class Meta(AbstractUser.Meta):
        swappable = "AUTH_USER_MODEL"

그렇다면 어떻게 User를 커스텀할까?

다양한 방법이 있지만 이번에 할 방식은 get_user_model() 함수를 사용하는 것!

get_user_model()

: 현재 활성화된 User 모델을 반환하며, 그렇지 않은 경우 User(default) 모델을 반환함

profiles/models.py

from django.db import models
from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
	pass

settings.py

AUTH_USER_MODEL = 'profiles.User'

—> AUTH_USER_MODEL은 profiles의 app의 models.py에서 내가 설정한 User를 사용하겠다고 설정하는 부분 !