Hi Rajesh, Thanks for your answer.
Basically, I have two forms (derived from models) that I validate on two pages. On the third page I would like to present the two datasets and save the models when the user validates them by clicking submit. One model (order) has a foreignkey to the other (customer). I would like to avoid writing in the db unless the customer has confirmed the order. But I think your suggestion of saving the post data (after the forms validate then) in a session key solves this worry; thanks for this. Btw, I am missing a new form method to show the contents of form in an uneditable way (e.g. input tag set on non editable.) Cheers, >>Michael On Aug 2, 10:21 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > But I run into trouble when saving in sessions via clean_data and then > > trying to initiate a newform with the saved clean_data. This occurs > > only when ForeignKeys are in the Game. > > > This is probably due to the nature foreignkeys are stored as an object > > in clean_data (see below). > > Correct. ModelChoiceField's clean_data results in the corresponding > related object instance and not its id. > > That makes your form.clean_data a dictionary that can not be used to > instantiate a new form. > > What is the flow of your 3 screens? Are you populating a single form > partially through each of three form submits? Do you need the > clean_data at each step (for example, are you validating on each > screen or only on the final screen)? > > You could store a copy of request.POST into your session instead of > form.clean_data. Then at each stage you get the current > request.POST.copy() and update it with the session's stored > request.POST.copy() and use that merged dictionary to instantiate that > stage's form. I am sure that there are other ways to skin this one > once you tell us a bit more about the flow you are looking to design. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

