Re: Authenticate User with Django 1.5
On 15/12/12 11:18, sebastien.morele@gmail.com wrote:
> Hi, i've an authenticate problem with Django 1.5
> All informations are
> herehttp://stackoverflow.com/questions/13883539/authenticate-with-django-1-5
> but i'll resume the situation :
>
> I've a custum user model which looks like :
>
> class User(AbstractBaseUser):
> email = models.EmailField(unique=True)
> activation_key = models.CharField(max_length=255)
> is_active = models.BooleanField(default=False)
> is_admin = models.BooleanField(default=False)
>
> objects = UserManager()
>
> USERNAME_FIELD = 'username'
>
<snip>
>
>
> The probleme is that user = authenticate(username=email,
> password=password) gives me None as return.
> According to the doc, authenticate takes an usersname, not an email as
> arg. But how can i use authenticate because my User model desn't support
> Username.
> Is there a solution with Django 1.5 ?
>
Have you tried changing USERNAME_FIELD to 'email'?
Ian
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home