November 2015
Beginner to intermediate
840 pages
26h 30m
English
To begin, we can create a new file under user/signals.py.
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.
Example 25.4: Project Code
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 ...
Read now
Unlock full access