Here's my function:

def check_form(request):
    if request.method == 'POST':
        form = UsersForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
                newUser =
                return HttpResponseRedirect('/testproject/summery/)
            except Exception, ex:
                # sys.stderr.write('Value error: %s\n' % str(ex)
                return HttpResponse("Error %s" % str(ex))
            return render_to_response('index.html', {'form': form}, context_instance=RequestContext(request))
        form = CiviguardUsersForm()
    return render_to_response('index.html',context_instance=RequestContext(request))

I want to pass each and every field in to a page call summery and display all the fields when user submits the form, so then users can view it before confirming the registration.


3 Answers

dzen On Best Solutions

You could build a dictionnary, with all your form fields, and use "render_to_response" :

newUser =
data = {}
for field in dir(newUser):
    if isinstance(getattr(newUser, field), Field):
        data[field] = getattr(newUser, field)
return render_to_response('summary.html', data, context_instance=RequestContext(request))

and use the variables in your template ?

dzen On

You may want to use the sessions, as described in ?

meshantz On

You could take a look at the Form Wizard which is included in the formtools contrib app. It's handy for creating multi-page forms, while keeping all of the data around.