Search code examples
pythondjangodjango-registration

Modify default registration form in Django-registration-redux


How do I add a custom field in the default registration of django-registration-redux ?

Also how do I disable the "verification-by-email" feature ?


Solution

  • You have to extend the parent User class.

    Here is an example where two new fields have been added:

    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
    

    For more check this link

    For registration without verification you should use The “simple” (one-step) backend and include following link in your project url.py file:

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

    for more details see here.