From abe7076a7384184ce4ab2fc7e7eae3ca11cda117 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 14 Dec 2017 11:25:36 -0800 Subject: [PATCH] Add the PagerTree form handler --- hc/front/views.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hc/front/views.py b/hc/front/views.py index 22853577..d7043f50 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -512,6 +512,23 @@ def add_pd(request, state=None): ctx = {"page": "channels", "connect_url": connect_url} return render(request, "integrations/add_pd.html", ctx) +@login_required +def add_pagertree(request): + if request.method == "POST": + form = AddUrlForm(request.POST) + if form.is_valid(): + channel = Channel(user=request.team.user, kind="pagertree") + channel.value = form.cleaned_data["value"] + channel.save() + + channel.assign_all_checks() + return redirect("hc-channels") + else: + form = AddUrlForm() + + ctx = {"page": "channels", "form": form} + return render(request, "integrations/add_pagertree.html", ctx) + def add_slack(request): if not settings.SLACK_CLIENT_ID and not request.user.is_authenticated: