Opened 7 years ago

Closed 7 years ago

#10441 closed (invalid)

form action="."

Reported by: rihad Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Chapter 7 of The Django Book says this:

The action="." means “Submit the form to the same URL as the current


I'm not sure this is standard or not, but it doesn't do what's
expected at least on Firefox 3.0.6 (Iceweasel of Debian 5.0 stable):
the form is simply submitted to an emtpy URL "/", which Django's web-
server logs on the console:

[08/Mar/2009 14:26:07] "GET /search HTTP/1.1" 200 205
[08/Mar/2009 14:26:10] "GET /?q= HTTP/1.1" 200 17

i.e. the first line shows me opening the form, and the next one logs
form submission, i.e. no HTTP-level redirects are ever done.

my urlpatterns looks like this:

(r'search/*$', search),


that is, the trailing slash is optional. Very interestingly, the "."
action submits correctly to itself only if I open the form as "http://", not as "" in the first
place, as the Django Book recommends. So it would be more correct to
say that "action="." submits the form to the same URL up to and
including the trailing slash, ignoring everything after it".

Change History (1)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

As explained in the thread on django-dev, this is working correctly. It requires understanding how relative URL references work (without the trailing slash, the last component will be stripped). All the Django documentation uses trailing slashes on URLs, partly because it provides the ability to use this kind of relative URL reference.

If there's a problem in the documentation for Django itself (at, then that would be good ot know about and fix. However, if this is just a problem with the book and, errors should be reported over there. That is separate from Django itself.

Note: See TracTickets for help on using tickets.
Back to Top