Kevin, Your fuzzy memory is quite correct. After some research it seems that you definitely can't do that unless you do some tricky **kwargs stuff to get around it. The lesson here is that the HTTP spec doesn't want you to do that and the Django Framework actively dissuades you from doing things like this. After implementing sessions it definitely seems like the right approach here. Passing variables became simple, I no longer needed subclass forms and mangle form data and most importantly I can use the correct Django style of posting each form to itself for validation before moving on to the next step. I don't mind that dead sessions means lost data, the scope of the app means that this data should definitely not be stored indefinitely.
As for the stored in db option, I will have a path in the code that allows logged in users to save more of their process while flowing through the app but in the end it shouldn't be saved at all till the process is done so sessions still works nicely. Ill see how ugly things get if I want to enable elegant back and forward buttons though :) Thanks again! Jason On Apr 29, 11:07 am, Kevin Audleman <kevin.audle...@gmail.com> wrote: > TheCorp, > > My memory on the issue is rather fuzzy, but I seem to recall that you > can't pass POST data along with a redirect, and that this has to do > with the way HTTP is designed. > > Using session variables seems like an excellent idea in my opinion. > One of the reason session variables were invented were to save the > programmer from having to pass data back-and-forth via forms. One side- > effect of this will be that if the user's session expires they will > lose their form data. This could be either good or bad based on your > needs. > > Another option that I have used in the past is to actually store the > data in the database as the user is going through the form. This would > require the user to create an account before filling out the form, but > it has the added benefit that it perfectly stores the state of their > form, allowing them to stop and restart at will. It also makes it easy > to create back buttons on each page, which you might find more > difficult if you are trying to pass form data (I think you'd have to > write extra code to pass the form backwards). > > Cheers, > Kevin > > On Apr 28, 5:40 pm, TheCorp <jjos...@keystreams.com> wrote: > > > As a note, I found this post which basically describes my current > > issue. > > >http://groups.google.com/group/django-users/browse_thread/thread/70c0... > > > The only problem is that I can't use the PRG approach. Half way > > through my steps I don't want forms to be displayed via URL/GET params > > because there will be sensitive info involved. > > > Seems to be leaning more and more towards sessions as my only option? > > > Thanks :) > > > On Apr 28, 3:49 pm, TheCorp <jjos...@keystreams.com> wrote: > > > > Hey all, fairly new to the Django community and trying to get a small > > > side project going. Basically im running into an issue with > > > architecture in that I am not sure how to proceed. > > > > Basically I am trying to code up a reservation system which spans a > > > few pages. Select a few things, input some text, add your billing info > > > and reserve. So the problem I am running into and I am fairly certain > > > this is from my own ineptitude, is that I am not sure the right way to > > > pass data between all of the pages. > > > > Nothing gets posted to the db till the end of the process but data > > > needs to be saved through each step because each step relies on the > > > data submitted from the previous step and all the steps before it. > > > Originally I wasn't even using Django Forms, I was just using Views/ > > > Templates. Each page would have an HTML form that would POST to the > > > next page/view and I would keep pushing data on via <input > > > type="hidden"> tags. > > > > After reading about Django Forms I figured that would be a good way to > > > go about doing it because I liked the idea of the built in validation > > > hooks. The problem I am running into now is that I have each step in > > > the process represented by a Form and in the template each HTML form > > > POSTs back to itself. This way I can check whether its validated > > > before moving on to the next step. The problem I have is that once I > > > have validated (is_valid()) that the form data was submitted > > > correctly, I can't seem to pass the request.POST data or the Form > > > itself onto the next page. > > > > I tried return render_to_response('template.html', {'form':form}) > > > which passes the data correctly to a template but then the URL is > > > messed up because its still the original URL from when the form posted > > > to itself and things get funky with my URLConf. I also tried to return > > > via HttpResponseRedirect() with different combinations (using reverse > > > () and other things) but I still can't seem to pass the POST data > > > correctly. > > > > So basically either I am not understanding how Forms work or I need to > > > use something else like Formsets/Sessions/FormWizard. Anyone have any > > > suggestions? My current idea is to use sessions to store the variables > > > as they flow through the process and POST everything in the final step > > > but tell me what you think. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---