On Fri, Mar 18, 2011 at 1:57 PM, Christophe <chris.pe...@gmail.com> wrote: > Thank you for your prompt reply Daniel! > > Let me clarify by detailing the example provided above: > > In my hypothetical form "formexample" on my hypothetical page "time/ > plus/3/", do you agree that if I put a relative URL in the action > field, like: action="myscript" it will eventually trigger a call to > "time/plus/3/myscript"? > > While I would (naturally, imho) expect a call to "myscript"? > > An example replacing slashes by underscores may help to better > understand: > > "formexample" is now inside a page called "time_plus_3/". The action > field still points to "myscript". Then I get the correct behavior. > > I hope I was convincing enough to highlight what seems to me a BIG > problem, but may be I am just either too picky or a bit silly. BIG > problem because it prevents people from easily relocating the web app > as it becomes tied to its prefix when using an absolute url. > > But I need to have a look at the {% url %} tag, that could solve my > existential problem. Thanks for the hint. >
There is definitely no big problem with URLs, pretty or otherwise. I think you may be misunderstanding some aspect of the url resolver/generator architecture to think that. Let me simplify the problem for you - never use relative URLs, and never manually create a URL. Django provides many ways to generate absolute URLs wherever you need them, use them. If you want to a link to a specific URL, use reverse() or {% url %} to generate it. If you want a form to submit to the same page it loaded from, omit the action attribute on the form. Cheers Tom -- 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.