I am creating an application in django and I have a user who can change the passwords and usernames of the other users.
In my views.py I have a view that controls this.
I get the user of a concrete username this way:
user = User.objects.get(username=user_name)
user.username = request.POST['username']
user.set_password(request.POST['password'])
user.save()
But when I save all, I see that the selected user's username didn´t changed.
How can I set the username and the password of the selected user "user_name"?
Thank you!
Aucun commentaire:
Enregistrer un commentaire