Why altering user object loses session?

I’ve noticed when a logged in user uses a certain form, everything is fine unless they modify the user object.

If they modify the user object then the session info seems to be lost and they have to login again.

Why does modifying the user object seem to nuke the session?

This is going to be tough to diagnose in the absence of seeing the code involved. We probably need to start with seeing this “certain form”, and the view that is processing it.


Thank you very much for your kind offer to help. I figured it out!


Apparently this is a “feature” added around ver 1.9! The logic, I suppose, is that
if someone modifies their user object, then it may be good to quickly verify you
can still log in. The link shows how to override it too if desired.



I suggest, for your own benefit, to never rely upon StackOverflow for accurate information about Django without referencing an authoritative source, nor to post links to it as references here. (SO is an “ok” starting point, but should never be considered authoritative.)

In this particular case, the information you’re looking for can be found at:


Thank you very much. It is much appreciated to get good help when one is stuck. Long live Django!