mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-29 00:35:45 +08:00
Added initial custom user model
This commit is contained in:
parent
f250cfd2e3
commit
82a327d47f
5 changed files with 83 additions and 9 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue