Пример #1
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'))
Пример #2
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"))
Пример #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"))
Пример #4
0
 def get(self, request, *args, **kwargs):
     form = TodoItemExportForm()
     if 'tag_slug' in kwargs:
         return render(request, "tasks/export.html", {
             "form": form,
             'tag': kwargs['tag_slug']
         })
     return render(request, "tasks/export.html", {"form": form})
Пример #5
0
 def get(self, request, *args, **kwargs):
     form = TodoItemExportForm()
     pk = None
     if 'pk' in self.kwargs:
         pk = self.kwargs['pk']
     return render(request, "tasks/export.html", {
         "form": form,
         'tag_pk': pk
     })
Пример #6
0
 def get(self, request, *args, **kwargs):
     form = TodoItemExportForm()
     print(kwargs)
     if 'tag_slug' in kwargs:
         return render(request, "tasks/export.html", {
             "form": form,
             "slug": kwargs["tag_slug"]
         })
     else:
         return render(request, "tasks/export.html", {"form": form})
Пример #7
0
 def get(self, request, *args, **kwargs):
     form = TodoItemExportForm()
     return render(request, "tasks/export.html", {"form": form})
Пример #8
0
 def get(self, request, tag_slug=None, *args, **kwargs):
     form = TodoItemExportForm()
     return render(request, "tasks/export.html", {"form": form, "tag": tag_slug})
Пример #9
0
 def get(self, request, *args, **kwargs):
     form = TodoItemExportForm()
     return render(request, 'tasks/export.html', {'form': form})