바뀜

둘러보기로 가기 검색하러 가기
228 바이트 추가됨 ,  2022년 12월 15일 (목) 13:38
편집 요약 없음
174번째 줄: 174번째 줄:  
이것과 from django.contrib.auth.models import User를 지우고, from django.conf import settings 후에
 
이것과 from django.contrib.auth.models import User를 지우고, from django.conf import settings 후에
   −
User 대신 settings.AUTH_USER_MODEL를 넣어주면 된다.
+
User 대신 <code>settings.AUTH_USER_MODEL</code>를 넣어주면 된다.
 +
 
 +
위 <code>settings.AUTH_USER_MODEL</code>은 텍스트만 반환하기 때문에, 유저 객체 자체를 불러오고 싶다면 <code>from django.contrib.auth import get_user_model</code> 을 사용하면 된다.
 
===settings.py에 만들 모델 추가===
 
===settings.py에 만들 모델 추가===
 
아래 작업은 DB 반영이 끝나 후에 진행해야 한다. 그렇지 않으면 <code>ValueError: The field admin.LogEntry.user was declared with a lazy reference to 'account.user', but app 'account' isn't installed.</code> 따위의 에러가 발생한다.
 
아래 작업은 DB 반영이 끝나 후에 진행해야 한다. 그렇지 않으면 <code>ValueError: The field admin.LogEntry.user was declared with a lazy reference to 'account.user', but app 'account' isn't installed.</code> 따위의 에러가 발생한다.

둘러보기 메뉴