Ejemplo n.º 1
0
def promote_client(user: _User, source: str) -> None:
    """
    Promote a user to Client role and change it's role on Mailchimp. Will not fail in case API call fails.
    Email welcome email is sent to user
    :param source: source of traffic
    :param user:
    :return:
    """
    _core_facade.promote_to_client(user, source)
    try:
        _mailchimp_facade.create_or_update_client(user.first_name, user.email)
    except _MailChimpError:
        pass
    email_msg = render_to_string(
        'payments/pytools_email.txt',
        {
            'user': user,
            'ty_url': build_absolute_uri(reverse('payments:pytools_thanks'))
        }
    )
    _send_mail(
        'Inscrição no curso Pytools realizada! Confira o link com detalhes.',
        email_msg,
        _settings.DEFAULT_FROM_EMAIL,
        [user.email]
    )
Ejemplo n.º 2
0
def promote_client(user: _User, email_msg: str) -> None:
    """
    Promote a user to Client role and change it's role on Mailchimp. Will not fail in case API call fails.
    Email welcome email is sent to user
    :param email_msg:
    :param user:
    :return:
    """
    _core_facade.promote_to_client(user)
    try:
        _mailchimp_facade.create_or_update_client(user.first_name, user.email)
    except _MailChimpError:
        pass
    _send_mail(
        'Inscrição no curso Pytools realizada! Confira o link com detalhes.',
        email_msg, _settings.DEFAULT_FROM_EMAIL, [user.email])