Beispiel #1
0
def share_by_sms(request, url, phone_number, body_template='smsbody.txt'):
	sharer = request.user
	medium = 'sms'
	sharee = get_or_create_user_by_phonenumber(phone_number)
	link = share_url(sharer, url, medium, sharee)

	extra_context = {'sharer': sharer, 'sharelink': link}
	message = render_to_string(body_template, extra_context)

	return send_sms(message, [phone_number])
Beispiel #2
0
def send_sms_view(request, template_name='send_sms_view.html', success_url='/smstest'):
    if request.method == 'POST':
        form = SendSMSForm(request.POST)
        if form.is_valid():
            message = form.cleaned_data['message']
            phone_number = form.cleaned_data['phone_number']
            sms = send_sms(message, [phone_number])
            return HttpResponseRedirect(success_url)
    else:
        form = SendSMSForm()
    return render_to_response(template_name, {'form': form})