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'))
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"))
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"))
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})
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 })
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})
def get(self, request, *args, **kwargs): form = TodoItemExportForm() return render(request, "tasks/export.html", {"form": form})
def get(self, request, tag_slug=None, *args, **kwargs): form = TodoItemExportForm() return render(request, "tasks/export.html", {"form": form, "tag": tag_slug})
def get(self, request, *args, **kwargs): form = TodoItemExportForm() return render(request, 'tasks/export.html', {'form': form})