I'd like to make some changes to def login
and def logout
in django.contrib.auth
__init.py__
. Specifically I want to add a mixpanel event to user login and logout.
I know I can do this by editing the file directly, although I assume this is not recommended due to version control / etc.
What's the best / easiest way to override these functions cleanly?
There's no reason to change the code at all. Both login and logout send signals; you can write code that listens to those signals and create your mixpanel events.