Hello, I have a submission form. When the form gets submitted I need to check to see if the b_state form variable is set to 'KS'. If so, then I need to let the user know that a sales tax will be applied to their order. If they agree with the price increase then they can select 'Submit' again and the order will be processed.
I currently have a setup that works...however I'm sure that it's not the most efficient way of doing it. So I'm posting my code in hope that some of you django experts can help me make it better. Here is my function that gets called when the checkout page is displayed def checkout(request): if request.method == 'POST': f = ContactForm(request.POST) a = theamount(request) if request['b_state'] == 'KS': if request.session['kansas'] == []: a = theamount(request, 1.06) request.session['kansas'].append({'style': "adsf"}) request.session.modified = True return render_to_response('checkout_form.htm', {'fo': f, 'o': request.session['cart'], 'p': a, 'isitks': True}) if f.is_valid(): request.session['orderdetails'] = { 'b_firstname': request['b_firstname'], } return HttpResponseRedirect('/plush/cart/success') else: return render_to_response('checkout_form.htm', {'fo': f, 'o': request.session['cart'], 'p': theamount(request)}) else: f = ContactForm(auto_id='%s') return render_to_response('checkout_form.htm', {'fo': f, 'o': request.session['cart'], 'p': theamount(request)}) ///////////////// As you can see I have problems. Is there anyway that I can do this without creating a session variable? The only reason I have the session variable is to know if the user has already seen the price update. That is how I know that I can go ahead and process the order. Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---