ubernostrum / django-registration

An extensible user-registration app for Django.
BSD 3-Clause "New" or "Revised" License
923 stars 241 forks source link

Use custom user model in RegistrationForm #236

Closed confuzeus closed 1 year ago

confuzeus commented 2 years ago

By default, Django will use its own default User model when initializing the CreationForm.

This will cause FieldErrors to be raised when a customer user model is provided but doesn't contain the same fields as in Django's default implementation.

That's why we use the custom user model to instantiate a CreationForm instead. The implementation can now have any fields it wants as long as it's compatible with Django's AbstractUser.

Fixes #234

ubernostrum commented 1 year ago

I'm going to close this for now because, as noted on #234, I plan to do a major version bump which will completely remove django-registration's dependency on UserCreationForm. So this will get fixed via the eventual django-registration 4.0 release, but in a different way than what this PR is doing.