Hello all,
I'm trying to configure Mezzanine to send me an email when a new user signs
up for an account on  my site, and couldn't find anything in the docs about
it, so I'm rolling my own by attaching a function to the post_save signal
from my UserProfile model:

@receiver(post_save, sender=UserProfile, dispatch_uid='myapp.userprofile')
def email_admins_on_new_signup(sender, instance, **kwargs):

    if kwargs['created']:
        # Only send an email if a new UserProfile was created.
        send_signup_alert_email_to_admins(instance)

This works fine for the new user's name and email address, but at the time
send_signup_alert_email_to_admins is called, the extra fields I've added
into UserProfile are not filled, so I can't include them in the email (they
get saved to the database OK). That is, e.g. instance.user.first_name
exists but instance.affiliation is None. Presumably UserProfile is saved
twice and I'm only picking up the first time, after it's been attached to a
user but before the extra data is attached to it.

What is the best solution to this problem? Is there a better way to go
about it than the approach I've taken?
Thanks,
Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to