Karen Tracey wrote: > On Sat, May 31, 2008 at 3:29 AM, M.Ganesh <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > Karen Tracey wrote: > > On Fri, May 30, 2008 at 9:48 PM, Karen Tracey > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote: > > > > On Fri, May 30, 2008 at 7:53 PM, M.Ganesh > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > <mailto:[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>>> wrote: > > > > > > Hi All, > > > > I have this url to start a note_l1 addition : > > '/contacts/note_l1/add/?entity=2' > > > > This reaches the server and my code intact. An 'Add; page is > > displayed. > > After I fill the form and press the 'Add' button only the > > '/contacts/note_l1/add/' portion reaches the server. the > > '?entity=2' is > > missing. I want to use this 'entity=2' info to redirect > to the > > relevant > > page. Unable to figure out what is happening. Can somebody > > kindly have a > > look. > > > > The details are here : http://dpaste.com/hold/53853/ > > > > Thanks in advance > > > > > > The url used for the form's POST is specified on the <form> > action > > attribute. What are you specifying for action= in your > template? > > Dot goes back to the same page, but I don't believe it carries > > along query strings. So if you want your POST to include a > query > > string I think you'll need to pass it through from the GET > > handling part of your view into your template so it can be > > included as part of the form's action attribute. > > > > > > Oops, also meant to mention probably a more common way of handling > > this kind of thing is via a hidden field in your form. > > > > Karen > Thanks Karen for your suggestion. But I further played around with the > above setup and have some intriguing observations. > > Instead of adding a 'note_l1' object, I tried adding a 'emailid' > object. > The view function worked as expected. The differences between the > 'note_l1' and 'emailid' objects, as far as I could see are : > 1. 'emailid' is a plain model whereas 'note_l1' is inherited from an > abstract model. > 2. 'note_l1' involves genericRelations > > > The really significant difference between your other models and your > new emailid model is email id has an 'entity' field. So when you POST > the form to create a new emailid this line of code: > > if request.REQUEST.has_key('entity'): > > returns True. But it's pulling 'entity' from the post data, not from > the query string. As you note in your annotation of the runserver > output, there is no query string included in the POST. The entity > value you get here will be whatever the user has selected for 'Entity' > in the posted form, it is not going to be tied at all to the 'entity' > query parameter on the original url. > > > Yes, it is action = "." indeed in the template > > > So based on experimentation (I haven't bothered to look it up in any > standard), I believe this is where you lose the query string. Form > action="." goes back to the url used for the GET, minus any query string. > > Karen > > The details (Version 2.0) are here : http://dpaste.com/hold/53887/ > > My Django version 0.97-pre-SVN-7543 > > Hope you can spend some more time on this. > > Thanks in advance > > Regards Ganesh > Thanks Karen, for providing the insight into 'POST' behavior. I'll use hidden fields to achieve my purpose.
Incidentally, I tried the above code with Apache-mod_python as well. The access.log of apache is here : http://dpaste.com/hold/54002/. There POST request also get the url parameters. Still it behaves the same way as with runserver. Thanks for your time once again Regards Ganesh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---