What does “action=” mean in a django template form mean?
It’s the standard HTML action tag. It supplies the HTTP operation and URL to use when the form is submitted.
So if you had a tag:
[form action=”/contact/” method=”post”]
(using brackets, to get around html grief), what that means is: when the user submits the form, submit it using a POST to the “/contact/” URL at the same server that the current page came from.
What would I put where /contact/ is?
Also, how would I reference the input of the form in a python file?
“/contact/” is a path on the web server. It needs to correspond to the URL that you associate with a request handler in your WSGIApplication call (see p.58 in the printed edition for an example).
You reference the form input inside the post function that you create as part of the request handler. Look at the sample code provided on p.63 of the printed edition (login-chat/pchat.py):
msgtext = self.request.get(“message”)
This assigns the contents of the “message” textarea in the form (p.62) to the variable msgtext.
i’m interesed too
|You must be logged in to comment|