Mo J. Mughrabi
Mo J. Mughrabi

Reputation: 6997

django using recaptcha conditionally after submitting the form

am stuck on trying to do this scenario which I didn't see much of, what am trying to do in the code below is show the registration form and once the user submits he/she will get recaptcha form.

I was wondering how can i pass the variables from the first form (registration form) after the user submits the recaptcha form. Is there a way I could work around this? below is my code

from django.shortcuts import render_to_response
from django.template.context import RequestContext
from forms import Registration_Form, reCaptcha_Form

def register(request):
    return render_to_response(  'core/accounts/register.html',
                                {
                                'form' : Registration_Form(),
                                },
                                context_instance=RequestContext(request)
                            )

def process_registration_form(request):
    if request.method == 'POST':
        registration_form = Registration_Form(request.POST)
    return render_to_response(  'core/accounts/recaptcha.html',
                                {
                                'form' : reCaptcha_Form(),
                                },
                                context_instance=RequestContext(request)
                            )

Upvotes: 0

Views: 109

Answers (1)

Torsten Engelbrecht
Torsten Engelbrecht

Reputation: 13496

Use Django Form Wizard or sessions.

Upvotes: 1

Related Questions