To begin, we can create a new file under
Our first goal is to import our necessary tools. We need the actual signals from auth as well as the
success() function from the messages app. We then import the
@receiver() decorator, which allows us to register our function to be called when a specific signal is sent, as shown in Example 25.4.
1 from django.contrib.auth.signals import ( 2 user_logged_in, user_logged_out) 3 from django.contrib.messages import success 4 from django.dispatch import receiver
In Example 25.5, we first program
display_login_message(), a function that displays ...