我正在使用带有 Django 1.5 的自定义用户配置文件,并且我正在尝试使用最新的 django-registration 版本,但在运行同步命令时总是出错。
CommandError: One or more models did not validate:
registration.registrationprofile: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
模型:
class UserProfile(AbstractBaseUser):
username = models.CharField(max_length=140)
email = models.EmailField(
verbose_name='email address',
max_length=254,
unique=True,
db_index=True,
)
设置:
AUTH_USER_MODEL = 'gofindwhat_app.UserProfile'