I have a use case, for which django-registration provides most of the required functionality. I need to do something "extra" though. By default django-registration
supports this workflow:
- A user signs up for an account by supplying a username, email address and password.
- From this information, a new User object is created, with its
is_active
field set toFalse
. Additionally, an activation key is generated and stored, and an email is sent to the user containing a link to click to activate the account.- Upon clicking the activation link, the new account is made active (the
is_active
field is set toTrue
); after this, the user can log in.
I need to send a "getting started" email after (or as part of) Step 3; i.e. when a user account becomes "active" (i.e. when "activation" is "complete" from a django-registration standpoint).
How do I insert this within the workflow above? I would like to use django-registration
and avoid reinventing the wheel.
django-registration
provides the user_activated
signal (read here).
The signal should be intercepted using the following code:
from registration.signals import user_activated
from django.dispatch import receiver
@receiver(user_activated)
def my_callback(sender, user, request):
# handle signal