class UserPhoneNumberView(FormView):
    form_class = UserPhoneNumberForm
template_name = 'get_user_phonenumber.html'

def form_valid(self, form):
    phonenumber = self.request.POST.get('mobile_number')
unique = self.request.POST.get('unique')
url = 'http://example.com/' + unique
body = quote('See this url: ' + url)
nonhttp_url = 'sms:' + phonenumber + '?body=' + body
context = {'url': nonhttp_url}
return render(request, 'theTemplate.html', context)
Calling a special (non-HTTP) URL from the form_valid method of a Django class-based view