1

Here's my function:

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

Thanks..

Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132
Switch
  • 14,783
  • 21
  • 69
  • 110

3 Answers3

2

You may want to use the sessions, as described in http://docs.djangoproject.com/en/dev/topics/http/sessions/ ?

dzen
  • 6,923
  • 5
  • 28
  • 31
0

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.

meshantz
  • 1,566
  • 10
  • 17
0

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

newUser = form.save()
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
  • 6,923
  • 5
  • 28
  • 31