DEV Community

Discussion on: Customizing Django Authentication using AbstractBaseUser

Collapse
 
joshwizzy profile image
Joshua Masiko

Hi Rahul,

RegistrationForm is used by the public-facing RegistrationView.
I use a separate form because it can include registration specific code that is not needed in the backend User Creation process (e.g captcha field, label, help text).
You can customize it to fit your requirements.

UserCreationForm and UserChangeForm are used by the auto-generated Django Admin backend.
The need to be rewritten since they are tied to the inbuilt User model as explained here

The relevant code is in accounts/admin.py:

...
class AccountAdmin(BaseUserAdmin):
    form = UserChangeForm
    add_form = UserCreationForm
...