Substitute default user model

newer-dal
LEdoian 4 years ago
parent 268955fa1e
commit a64d986755

@ -1,3 +1,5 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from utils.models import MyUser
# Register your models here. admin.site.register(MyUser, UserAdmin)

@ -1,3 +1,6 @@
from django.db import models from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here. # https://docs.djangoproject.com/en/3.1/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project
class MyUser(AbstractUser):
pass

@ -37,6 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'utils',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -118,3 +120,5 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.1/howto/static-files/ # https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
AUTH_USER_MODEL = 'utils.MyUser'

Loading…
Cancel
Save