ubernostrum / django-registration

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

Subclassing registration.forms.RegistrationForm #153

Closed tobyspark closed 6 years ago

tobyspark commented 6 years ago

Thanks for django-registration, I implemented it on the site I’m developing. Two notes.

  1. I have a custom user model and subclassing registration.forms.RegistrationForm wasn’t working for me. My custom user model is about as standard as can be, so this was surprising (I just use email as username, with a first and last name field). In the end I wrote my own subclass of UserCreationForm using some of the RegistrationForm code. It’s here: https://github.com/tobyspark/folk-rnn-webapp/blob/47091a550bcc2b9f6b42b27652415e5879012b4c/folk_rnn_site/archiver/forms.py

  2. The documentation says that url(r'^', include('registration.backends.hmac.urls')), should also include the django.contrib.auth.urls. And looking into the code, it seemed that way too. But it wasn’t working for me, I couldn’t figure it out (it got late...), and simply havingurl(r'^', include('django.contrib.auth.urls')), as well worked.

kti-matt commented 6 years ago

For (1), was it the error Manager isn't available; 'auth.User' has been swapped for 'myapp.User' that you were seeing? If so, you may not have overridden your RegistrationForm's Meta class as described here: https://django-registration.readthedocs.io/en/2.4.1/custom-user.html#overview

I had this problem, came here to describe my solution as if I had discovered it myself, and then realized that it's documented at the above link.

ubernostrum commented 6 years ago

Without knowing what went wrong I can't help diagnose this. If you have more information to provide, feel free to reopen.

tobyspark commented 6 years ago

Yes – this was just feedback, notes. There isn’t really a place for not-directly actionable things. Thanks again for the work @ubernostrum