修改 Django-registration-redux 中的默认注册表单



如何在 django-registration-redux 的默认注册中添加自定义字段?

另外,如何禁用"通过电子邮件验证"功能?

您必须扩展父用户类。

下面是添加两个新字段的示例:

class UserProfile(models.Model):
    # This line is required.Links Userprofile to a User model instance.
    user = models.OneToOneField(User)
    # The additional attributes we wish to include.
    website = models.URLField(blank=True)
    picture = models.ImageField(upload_to='profile_images', blank=True)
    # Override th __unicode__() method to return out something meaningful!
    def __unicode__(self):
        return self.user.username

欲了解更多信息,请查看此链接

对于未经验证的注册,您应该使用"简单"(一步)后端,并在项目 url.py 文件中包含以下链接:

(r'^accounts/', include('registration.backends.simple.urls')),

有关更多详细信息,请参阅此处。

最新更新