On Sat, Jul 4, 2009 at 8:09 PM, zweb <traderash...@gmail.com> wrote: > > i just increased the size of username in auth_user table to 100 and I > enter email as user name from my register user web page. >
Just for the record this is unsupported in Django (due to the constaints django.contrib.auth.models.User.username), and I will guarantee this behavior will break in the future when model validation hits (currently a GSOC project). The reason e-mail isn't used as a username is due to, I assume, the way it was initially created. There are a lot of sites that would prefer to have a username instead of an e-mail available to the users. So a decision was made a long time ago and released for us to use. And for me, and a lot of other people who use Django, and even for your use case with the e-mail authentication, it works well. That said the custom auth backend and reading from a field named e-mail directly, as I showed in the links, is really simple and the code is already written for you. The only tricky part is creating a username, which you can do by parsing the email address and placing it in the username field. Simple really, only you need to know that is what is happening. My recommendation is to extend the auth module a touch by adding less than 40 LOC to your code base. You could also rewrite the auth module if you would like. I would not recommend relying on the undocumented behavior. Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---