<s> from django . contrib . auth . signals import ( <EOL> user_logged_in , user_logged_out ) <EOL> from django . contrib . messages import success <EOL> from django . dispatch import receiver <EOL> @ receiver ( user_logged_in ) <EOL> def display_login_message ( sender , ** kwargs ) : <EOL> request = kwargs . get ( '<STR_LIT>' ) <EOL> user = kwargs . get ( '<STR_LIT:user>' ) <EOL> success ( <EOL> request , <EOL> "<STR_LIT>" . format ( <EOL> user . get_short_name ( ) ) , <EOL> fail_silently = True ) <EOL> @ receiver ( user_logged_out ) <EOL> def display_logout_message ( sender , ** kwargs ) : <EOL> request = kwargs . get ( '<STR_LIT>' ) <EOL> success ( <EOL> request , <EOL> "<STR_LIT>" , <EOL> fail_silently = True ) </s>
