Django 사용자 테이블 다시 쓰기

1210 단어 django
응용 프로그램 등록 및 AUTH 설정USER_MODEL
settings.py
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'users',
]
AUTH_USER_MODEL = "users.Users"

.app.models.py
class Users(AbstractUser):
    nick_name = models.CharField(max_length=50, verbose_name=u"  ", default="")
    birthday = models.DateField(verbose_name=u"  ", null=True, blank=True)
    gender = models.CharField(choices=(("male", u" "), ("female", " ")), default="female",max_length=5)
    address = models.CharField(max_length=100, default="")
    mobile = models.CharField(max_length=11, null=True, blank=True)
    image = models.ImageField(upload_to="image/%Y/%m", default=u"image/default.png", max_length=100)

    class Meta:
        verbose_name = "    "
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.username

좋은 웹페이지 즐겨찾기