@require_setting('PD_VENDOR_KEY')
@login_required
def add_pdc(request, code):
    project = _get_rw_project_for_user(request, code)
    state = token_urlsafe()
    callback = (settings.SITE_ROOT + reverse('hc-add-pdc-complete', args=[project.code, state]))
    connect_url = ('https://connect.pagerduty.com/connect?' + urlencode({'vendor': settings.PD_VENDOR_KEY, 'callback': callback}))
    ctx = {'page': 'channels', 'project': project, 'connect_url': connect_url}
    request.session['pd'] = state
    return render(request, 'integrations/add_pdc.html', ctx)
@require_setting('PD_VENDOR_KEY')
@login_required
def add_pdc(request, code):
    project = _get_rw_project_for_user(request, code)
    state = token_urlsafe()
    callback = (settings.SITE_ROOT + reverse('hc-add-pdc-complete', args=[project.code, state]))
    connect_url = ('https://connect.pagerduty.com/connect?' + urlencode({'vendor': settings.PD_VENDOR_KEY, 'callback': callback}))
    ctx = {'page': 'channels', 'project': project, 'connect_url': connect_url}
    request.session['pd'] = state
    return render(request, 'integrations/add_pdc.html', ctx)