Django updating username results in unusable password. How to prevent this?
I am using code to update the user details and whilst the values are updating I have noticed that when I update the username, which is an email address, the password is set to an unusable password, as if set_unusable_password() were used. If I don't update the username but change the first_name and last_name everything is fine. Why? And how can I stop this behaviour?
User.objects.filter(username=username).update(
first_name=first_name,
last_name=last_name,
username=username/new_user_name,
)