Creating basic registration/ authentication in Django is insanely hard.
After many tries, I manage to create basic registration/ authentication in Django using username
and password
.
The code is shown in https://github.com/yccheok/django
Now, I wish to create registration form which only use email
and password
. No username.
I try to following the official example https://docs.djangoproject.com/en/dev/topics/auth/customizing/#a-full-example . The example is using email, password and DOB for registration. I'm not interested in DOB, but I will just simply follow the example at this point.
I made the following changes : https://github.com/yccheok/django/commit/ae0b16d38a39fad78a2137e2649c0f3fda12a3ff
However, I'm facing 2 problems.
username
and password
text fields. What I'm expecting are email
and password
text fields.Manager isn't available; 'auth.User' has been swapped for 'accounts.MyUser'
after clicking Sign up
button. I had read Manager isn't available; 'auth.User' has been swapped for 'polls.User' , but total clueless on how to apply the solution in my case.There's one thing confusing me.
Why in accounts/admin.py
, we are using from accounts.models import MyUser
. But in web/settings.py
, we are using AUTH_USER_MODEL = 'accounts.MyUser'
(Instead of AUTH_USER_MODEL = 'accounts.models.MyUser'
)
Any idea how I can modify my basic workable registration/login example (https://github.com/yccheok/django), to make them register using email
and password
?