python - 如何通过 django-registration 使用自定义配置文件

标签 python django django-registration

我在 Django 1.5 中使用自定义用户配置文件,并且尝试使用最新的 django 注册版本,但在运行同步命令时总是出现错误。

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'

最佳答案

奥尔加,我第一次必须做这个改变: https://bitbucket.org/prjts/django-registration/commits/ba31fc3053bfca7eb7a19d912882e50e295adc55

第二,我必须基于默认后端创建自己的后端。

关于python - 如何通过 django-registration 使用自定义配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16488868/

相关文章:

python - 如何从屏幕中提取选定的矩形作为顶 View 图像?

java - android python 完全集成

python - 在单独的线程中保存模型

Django 按需创建/更改表

django - 自定义 django 注册表格

python - 如何在 nginx 上提供 Django 静态文件

python - 使用 Pandas 中 DataFrame 单元格中存储的列表的值

python - Django 测试在测试数据库创建上浪费了太多时间

python - 在注册中验证电子邮件不会在 Django 中引发validationError?

django - 扩展 django-registration RegisterForm 类的正确方法