Django authentication with long usernames
In the models.py of django/django/contrib/auth the username is length is changed to 64 fields instead of 30 and the username in database has varchar(64).But it doesnt allow to login with a long username like harry@sdsdasfdfdfgdfgdfgdfgdfgdfg.com
how can this be fixed
class User(models.Model):
"""
Users within the Django authentication system开发者_运维技巧 are represented by this model.
Username and password are required. Other fields are optional.
"""
username = models.CharField(_('username'), max_length=64, unique=True, help_text=_("Required. 64 characters or fewer. Letters, numbers and @/./+/-/_ characters"))
I would recommend that you not monkey patch Django, but instead create your own authentication backend. You can then validate against a user's email like in this example: http://djangosnippets.org/snippets/1845/
I know this is an old question, but I feel it's time for a new answer since custom User models is arguably the best feature of django 1.5.
From now on one can create his own custom User model and use it along with existing authentication functionality. The latest documentation covers it all in detail here https://docs.djangoproject.com/en/dev/topics/auth/#auth-custom-user.
Hey buddy there is a nice application named django-registration in the bitbucket, i m sure u will get a possible way to accomplish your task. Please let me know if this link helps you out. http://bitbucket.org/ubernostrum/django-registration
精彩评论