user.set_password('new password')

1,085 views
Skip to first unread message

Min Hong Tan

unread,
May 19, 2012, 12:53:43 AM5/19/12
to django...@googlegroups.com
Hi,

I 'm trying to change password in views.py in one of my  def.
having the below code.
newpassword ="testing123"
user = User.objects.get(username__exact = request.user)
user.set_password(newpassword)
user.save

it didn't prompt me any error.  but, why my password still remained unchanged?

Regards,
MH


Jonathan D. Baker

unread,
May 19, 2012, 1:48:24 AM5/19/12
to django...@googlegroups.com, django...@googlegroups.com
Save is a method, so it needs parentheses: user.save()

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Min Hong Tan

unread,
May 19, 2012, 2:23:31 AM5/19/12
to django...@googlegroups.com
hi..

thanks!! haha... didn't notice  that. how can no error...prompt out one....

Timothy Makobu

unread,
May 19, 2012, 11:49:20 AM5/19/12
to django...@googlegroups.com
user.save returns the function object, which is a valid statement, so Python wont raise an Exception.

Min Hong Tan

unread,
May 19, 2012, 3:55:37 PM5/19/12
to django...@googlegroups.com
thanks all :) 

bruno desthuilliers

unread,
May 21, 2012, 8:39:40 AM5/21/12
to Django users
On May 19, 5:49 pm, Timothy Makobu <makobu.mwambir...@gmail.com>
wrote:
> user.save returns the function object,

<pedantic>
actually it evals to a method object
</pedantic>

;)

Timothy Makobu

unread,
May 21, 2012, 9:54:42 AM5/21/12
to django...@googlegroups.com
And a method is a function only accessible through a class.


Reply all
Reply to author
Forward
0 new messages