Added initial custom user model

This commit is contained in:
Keannu Christian Bernasol 2023-06-26 19:45:58 +08:00
parent f250cfd2e3
commit 82a327d47f
5 changed files with 83 additions and 9 deletions

View file

@ -35,6 +35,7 @@ ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
# Application definition
INSTALLED_APPS = [
'accounts',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@ -44,7 +45,7 @@ INSTALLED_APPS = [
'rest_framework',
'djoser',
'rest_framework.authtoken',
'accounts',
]
MIDDLEWARE = [
@ -81,12 +82,6 @@ REST_FRAMEWORK = {
)
}
DJOSER = {
'SEND_ACTIVATION_EMAIL': True,
'SEND_CONFIRMATION_EMAIL': True,
'ACTIVATION_URL': 'activation/{uid}/{token}',
}
WSGI_APPLICATION = 'config.wsgi.application'
@ -100,6 +95,20 @@ DATABASES = {
}
}
AUTH_USER_MODEL = 'accounts.CustomUser'
DJOSER = {
'SEND_ACTIVATION_EMAIL': True,
'SEND_CONFIRMATION_EMAIL': True,
'ACTIVATION_URL': 'activation/{uid}/{token}',
'USER_AUTHENTICATION_RULES': ['djoser.authentication.TokenAuthenticationRule'],
'SERIALIZERS': {
'user': 'accounts.serializers.CustomUserSerializer',
'user_create': 'accounts.serializers.UserRegistrationSerializer',
},
}
# Email credentials
if (DEBUG == True):
EMAIL_HOST = str(os.getenv('DEV_EMAIL_HOST'))