3👍
✅
That is one of the issues with using email addresses for user names in Django. Many, many emails are over 30-characters. One common way to address this issues is using a custom “Authentication Backend” for email authentication. Using your own backend you can authenticate a user based on the email
field instead of the username
field. You can then generate the username based on that email address or using random generated usernames.
You can read more about this approach on my blog post Django Authentication using an Email Address.
2👍
Maybe it is not right way, but in my project i just increased user email size with south. Sample:
>> ./manage.py schemamigration auth --initial && ./manage migrate auth --fake
Then i added into models.py:
from django.contrib.auth.models import User
field = User._meta.get_field('email')
field.max_length = 254
field = User._meta.get_field('username')
field.max_length = 254
Now:
>> ./manage.py schemamigration auth --auto
>> ./manage.py migrate auth
- [Django]-A following models with django neomodel
- [Django]-Django Template: Use translation in default_if_none
- [Django]-Django paginate the original search result
Source:stackexchange.com