ubernostrum / django-registration

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

Manager isn't available; User has been swapped for 'myuser.MyUser' - again #193

Closed ManPython closed 4 years ago

ManPython commented 4 years ago

Here is problem with django_registration related with url https://code.djangoproject.com/ticket/31108

ubernostrum commented 4 years ago

Please read the custom-user documentation, which tells you how to use a custom user model with django-registration.

ManPython commented 4 years ago

It's not the model problem.. the URL libs include that made problems for django. Great.. I reporting bugs or problems.. the area predicted to watch this talking about reading..

ubernostrum commented 4 years ago

The thing is, I get reports like this pretty regularly, and the answer is pretty much always found by reading documentation and comparing your code to what the documentation recommends.

Of course, sometimes people don't believe me. And for a long time I just shrugged that off. But now I'm tired enough of it that I went and expanded django-registration's test suite to install a custom user model and configure it correctly and re-run the tests of the built-in registration workflows using that custom user model. I've also added code in RegistrationView to check for the most common bug -- someone sets a custom user model and doesn't provide a form for it -- and raise an ImproperlyConfigured exception.

Here's the output of a CI build. The additional tests also assert that they're running with a custom user model.

So I don't know what went wrong in your code, but I do know, and can prove via the test suite, that if you follow the instructions django-registration works with a custom user model.

ManPython commented 4 years ago

@ubernostrum Do you try test with this 2 cases? This diffrent order made this bug/issue, and info messgage made that coders searching around the title error.

1:

url(r'^accounts/register/$', RegistrationView.as_view(form_class=ProfileRegistrationForm), 
url(r'^accounts/', include('django_registration.backends.one_step.urls')),

2:

url(r'^accounts/', include('django_registration.backends.one_step.urls')),
url(r'^accounts/register/$', RegistrationView.as_view(form_class=ProfileRegistrationForm), 
ubernostrum commented 4 years ago

You should feel free to look at the tests to see how it's configured. But the point here is that there is no bug in django-registration to fix with regard to custom user models, because django-registration works just fine with a custom user model.