ubernostrum / django-registration

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

Using `UserCreationForm` #187

Closed jonathan-s closed 5 years ago

jonathan-s commented 5 years ago

The UserCreationForm uses django.contrib.auth.models.User not the user used in settings. So when you use the registrationform with a custom user model this will fail.

https://github.com/django/django/blob/master/django/contrib/auth/forms.py#L94

I would say that the core issue lies in django, but getting a fix upstream will probably take longer than getting a fix here.

ubernostrum commented 5 years ago

The base RegistrationForm is deliberately set up this way to force you to write your own form when using a custom User model. That reduces the chance of someone having a User model that accidentally mostly works with the default form and then breaks mysteriously later on.