2👍
I think things will be easier in the long run if you keep using the default user profile. If you are only trying to add the ability to log in with an email address, I recommend creating a new authentication backend:
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
class EmailModelBackend(ModelBackend):
def authenticate(self, username=None, password=None):
try:
user = User.objects.get(email__iexact=username)
if user.check_password(password):
return user
except User.DoesNotExist:
return None
You would then need to that backend to your settings.py:
AUTHENTICATION_BACKENDS = (
'yourproject.yourapp.yourmodule.EmailModelBackend',
'django.contrib.auth.backends.ModelBackend'
)
1👍
As-is, it’s complicated. You need to:
- apply this patch because in d-r-1.0, models.py assumes your User model has a “username” field
- create your own “backend” by copy/pasting/editing registration/backends/default/views.py
- copy/paste/edit the registration form as well from registration/forms.py
- most of the time you can use the registration views without modification
The question is about custom User and Django 1.5, so i think django-registration-email is a bad answer. Thisi is for Django <1.5, creating fake usernames and turning around the problem.
- [Django]-Override default_error_messages on SlugRelatedField
- [Django]-'web:' is not recognised as an internal or external command
- [Django]-Virtualenv, sys.path and site-packages
- [Django]-How to include templates to a django package?
0👍
This might help you out:
https://pypi.python.org/pypi/django-registration-email/0.5.1
They’ve implemented this in django-registration
👤Jay
- [Django]-Error message: "'NoneType' object is not callable". – received from zappa deployed django application on AWS Lambda
- [Django]-Django ModelForm widgets and labels
- [Django]-Function with arguments in a template. Django
Source:stackexchange.com