Example #1
0
def request_f(request):
    c = get_common_context(request)
    if request.POST and request.POST['action'] == 'request':
        call_form = RegisterForm(request.POST)
        if call_form.is_valid():
            call_form.save()
            call_form = RegisterForm()
            #messages.success(request, u'Спасибо! В ближайшее время мы Вам перезвоним.')
            return HttpResponseRedirect(request.POST['next'])
    raise Http404()
Example #2
0
def ajax_request(request):
    if request.is_ajax():
        json_data = {'result': True}
        call_form = RegisterForm(request.POST)
        if call_form.is_valid():
            call_form.save()
        else:
            json_data['result'] = False
            json_data['errors'] = call_form.errors
        return HttpResponse(dumps(json_data), mimetype='application/json')