바뀜

둘러보기로 가기 검색하러 가기
141 바이트 추가됨 ,  2021년 11월 7일 (일) 18:32
52번째 줄: 52번째 줄:  
|<syntaxhighlight lang="python">
 
|<syntaxhighlight lang="python">
 
from django.db import models
 
from django.db import models
from django.contrib.auth.models import (BaseUserManager, AbstractBaseUser)
+
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|-
 
|-
172번째 줄: 172번째 줄:  
User 대신 settings.AUTH_USER_MODEL를 넣어주면 된다.
 
User 대신 settings.AUTH_USER_MODEL를 넣어주면 된다.
 
===settings.py에 만들 모델 추가===
 
===settings.py에 만들 모델 추가===
아래 작업은 DB 반영이 끝나 후에 진행해야 한다. 그렇지 않으면 ValueError: The field admin.LogEntry.user was declared with a lazy reference to 'account.user', but app 'account' isn't installed. 따위의 에러가 발생한다.
+
아래 작업은 DB 반영이 끝나 후에 진행해야 한다. 그렇지 않으면 <code>ValueError: The field admin.LogEntry.user was declared with a lazy reference to 'account.user', but app 'account' isn't installed.</code> 따위의 에러가 발생한다.
    
보통은 앱이름은 account, 모델이름은 User 따위가 된다.<syntaxhighlight lang="python">
 
보통은 앱이름은 account, 모델이름은 User 따위가 된다.<syntaxhighlight lang="python">
AUTH_USER_MODEL = 'account.User'  # 관리유저로 사용할 모델을 설정한다.
+
AUTH_USER_MODEL = 'custum_account.User'  # 관리유저로 사용할 모델을 설정한다.
 
   
</syntaxhighlight>
 
</syntaxhighlight>
   185번째 줄: 184번째 줄:     
==관리자 화면에 등록==
 
==관리자 화면에 등록==
admin.py를 작성한다.<syntaxhighlight lang="python">
+
아직 관리자 화면에선 가입한 유저들의 정보가 나오지 않는다. 이들을 한눈에 관리하기 위해 admin.py를 작성한다.<syntaxhighlight lang="python">
 
from django.contrib import admin
 
from django.contrib import admin
 
from .models import User  # 직접 등록한 모델
 
from .models import User  # 직접 등록한 모델

둘러보기 메뉴