Критерии достижения:
- Создано Celery-приложение c методами:
- send_email
- do_import
- Создан view для запуска Celery-задачи do_import из админки.
def password_reset_token_created(sender, instance, reset_password_token, **kwargs):
"""
Отправляем письмо с токеном для сброса пароля
When a token is created, an e-mail needs to be sent to the user
:param sender: View Class that sent the signal
:param instance: View Instance that sent the signal
:param reset_password_token: Token Model Object
:param kwargs:
:return:
"""
# send an e-mail to the user
msg = EmailMultiAlternatives(
# title:
f"Password Reset Token for {reset_password_token.user}",
# message:
reset_password_token.key,
# from:
settings.EMAIL_HOST_USER,
# to:
[reset_password_token.user.email]
)
msg.send()