tags:

views:

35

answers:

1

When one needs to define action parameter of form ? Across different projects I've seen forms with action defined as {% url app.view parameters %} or simply '/contact/' but also with action = "." . When do we need to provide each type of action ?

A: 

action is simply the URL that the form is submitted to.

Normally in Django, a form is submitted to the same URL that originally rendered it, which is why '.' is often used. If you want to submit it to a different URL, for instance in the case of a search box that is shown on every page but processed on a single page, you can hard-code the URL or use the {% url %} tag to reverse-lookup the value to submit to.

Daniel Roseman