标签:
以前都是直接与user
最近看书,上说settings.AUTH_USER_MODEL,这样好些。。。是为记。
from django.db import models from django.conf import settings class Profile(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL) date_of_birth = models.DateField(blank=True, null=True) photo = models.ImageField(upload_to=‘users/%Y/%m/%d‘, blank=True) def __str__(self): return ‘Profile for user {}‘.format(self.user.username)
标签:
原文地址:http://www.cnblogs.com/aguncn/p/5653304.html