def create_number(request): if request.method == "POST": form = TwilioNumberForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('twilioproj.twilioapp.views.index_number')) else: form = TwilioNumberForm() return render_to_response('twilioapp/create_number.html', { 'form': form, })
def edit_number(request, phone_number): if request.method == "POST": form = TwilioNumberForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('twilioproj.twilioapp.views.index_number')) else: number = get_object_or_404(TwilioNumber, phone_number=phone_number) form = TwilioNumberForm(instance=number) return render_to_response('twilioapp/edit_number.html', { 'form': form, })