def add_pd(request): if request.method == "POST": form = AddPdForm(request.POST) if form.is_valid(): channel = Channel(user=request.team.user, kind="pd") channel.value = form.cleaned_data["value"] channel.save() channel.assign_all_checks() return redirect("hc-channels") else: form = AddPdForm() ctx = {"page": "channels", "form": form} return render(request, "integrations/add_pd.html", ctx)
def add_pd(request, code): project = _get_project_for_user(request, code) if request.method == "POST": form = AddPdForm(request.POST) if form.is_valid(): channel = Channel(project=project, kind="pd") channel.value = form.cleaned_data["value"] channel.save() channel.assign_all_checks() return redirect("hc-p-channels", project.code) else: form = AddPdForm() ctx = {"page": "channels", "form": form} return render(request, "integrations/add_pd.html", ctx)