Пример #1
0
 def post(self, request, tag_slug=None, *args, **kwargs):
     form = TodoItemExportForm(request.POST)
     if form.is_valid():
         email = request.user.email
         body = self.generate_body(request.user, form.cleaned_data, tag_slug)
         send_mail("Задачи", body, settings.EMAIL_HOST_USER, [email])
         messages.success(request, "Задачи были отправлены на почту %s" % email)
     else:
         messages.error(request, "Что-то пошло не так, попробуйте ещё раз")
     return redirect(reverse("tasks:list"))
Пример #2
0
 def post(self, request, *args, **kwargs):
     form = TodoItemExportForm(request.POST)
     if form.is_valid():
         email = request.user.email
         body = self.generate_body(request.user, form.cleaned_data)
         send_mail('Задачи', body, settings.EMAIL_HOST_USER, [email])
         messages.success(request, f'Задачи были отправлены на почту {email}')
     else:
         messages.error(request, 'Что-то пошло не так, попробуйте ещё раз')
     return redirect(reverse('tasks:list'))
Пример #3
0
 def post(self, request, *args, **kwargs):
     form = TodoItemExportForm(request.POST)
     if form.is_valid():
         email = request.user.email
         body = self.generate_body(request.user, form.cleaned_data)
         send_mail("Tasks", body, settings.EMAIL_HOST_USER, [email])
         messages.success(
             request, "Tasks have been sent by the e-mail %s" % email)
     else:
         messages.error(request, "Something went wrong, try again")
     return redirect(reverse("tasks:list"))