Monday, August 29, 2011

Re: How to use email as user login name

I go through the source code of django, which is Django-1.3/django/
contrib/auth/model.py. Can I just modify username = models.CharField
to username = models.EmailField, and then change email to CharField
by which I can use email as username.

Thank you.

On Aug 28, 7:46 pm, Shawn Milochik <sh...@milochik.com> wrote:
> On 08/28/2011 03:26 PM, quasar wrote:
>
> > Question is how to use email as user login name, and make user name
> > not unique? What's the best way to do that?
>
> To use e-mail as login, write your own backend (about four lines of
> code). You'll be using the 'email' field, not username, because username
> isn't long enough.
>
> You can not make username not unique if you're using
> contrib.auth.models.User, but you can populate it with whatever junk you
> want because you won't be using it for anything else.
>
> https://docs.djangoproject.com/en/1.3/topics/auth/#authentication-bac...

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment