Django | passing form values

Posted by MMRUser on Stack Overflow See other posts from Stack Overflow or by MMRUser
Published on 2010-05-21T14:01:20Z Indexed on 2010/05/21 14:10 UTC
Read the original article Hit count: 191

Filed under:

I want to create a user sign up process that requires two different forms with the same data one (1st form) is for filling out the data and other one (2nd form) is for displaying the filled data as a summery (before actually saving the data) so then user can view what he/she has filled up... my problem is that how do I pass 1st form's data in to the 2nd one .. I have used the basic Django form manipulation mechanism and passed the form field values to the next form using Django template tags..

if request.method == 'POST':
    form = Users(request.POST)
    if form.is_valid():
        cd = form.cleaned_data
        try:
            name = cd['fullName']
            email = cd['emailAdd']
            password1 = cd['password']
            password2 = cd['password2']
            phoneNumber = cd['phoneNumber']
            return render_to_response('signup2.html', {'name': name, 'email': email, 'password1': password1, 'password2': password2, 'phone': phone, 'pt': phoneType})
        except Exception, ex:
            return HttpResponse("Error %s" % str(ex))  

and from the second from I just displayed those field values using tags and also used hidden fields in order to submit the form with values, like this:

<label for="">Email:</label> {{ email }} <input type="hidden" id="" name="email" class="width250" value="{{ email }}" readonly />

It works nicely from the out look, but the real problem is that if someone view the source of the html he can simply get the password even hackers can get through this easily. So how do I avoid this issue.. and I don't want to use Django session since this is just a simple sign up process and no other interactions involved.

Thanks.

© Stack Overflow or respective owner

Related posts about django