@require_setting('TWILIO_AUTH')
@login_required
def add_sms(request, code):
    project = _get_rw_project_for_user(request, code)
    if (request.method == 'POST'):
        form = forms.AddSmsForm(request.POST)
        if form.is_valid():
            channel = Channel(project=project, kind='sms')
            channel.name = form.cleaned_data['label']
            channel.value = json.dumps({'value': form.cleaned_data['value']})
            channel.save()
            channel.assign_all_checks()
            return redirect('hc-channels', project.code)
    else:
        form = forms.AddSmsForm()
    ctx = {'page': 'channels', 'project': project, 'form': form, 'profile': project.owner_profile}
    return render(request, 'integrations/add_sms.html', ctx)
@require_setting('TWILIO_AUTH')
@login_required
def add_sms(request, code):
    project = _get_rw_project_for_user(request, code)
    if (request.method == 'POST'):
        form = forms.AddSmsForm(request.POST)
        if form.is_valid():
            channel = Channel(project=project, kind='sms')
            channel.name = form.cleaned_data['label']
            channel.value = json.dumps({'value': form.cleaned_data['value']})
            channel.save()
            channel.assign_all_checks()
            return redirect('hc-channels', project.code)
    else:
        form = forms.AddSmsForm()
    ctx = {'page': 'channels', 'project': project, 'form': form, 'profile': project.owner_profile}
    return render(request, 'integrations/add_sms.html', ctx)