diff options
| author | Gary Wilson Jr <gary.wilson@gmail.com> | 2007-10-19 04:47:07 +0000 |
|---|---|---|
| committer | Gary Wilson Jr <gary.wilson@gmail.com> | 2007-10-19 04:47:07 +0000 |
| commit | 5c8b26df151117c2d0db8ad73681599cb79864bb (patch) | |
| tree | 332d8ec32947257feef41b3bc114ee3ee9357c87 /docs | |
| parent | a1723aba3bf56a5551d04d1e5728d6f2fc7fd0c0 (diff) | |
Fixed #5666 -- Documented the `prefix` keyword argument for newforms.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/newforms.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/newforms.txt b/docs/newforms.txt index 2005adeec8..3a9f539dc8 100644 --- a/docs/newforms.txt +++ b/docs/newforms.txt @@ -860,6 +860,23 @@ classes:: <li>Instrument: <input type="text" name="instrument" /></li> <li>Haircut type: <input type="text" name="haircut_type" /></li> + +Prefixes for forms +------------------ + +You can put several Django forms inside one ``<form>`` tag. To give each +``Form`` its own namespace you need to use the ``prefix`` keyword argument:: + + >>> mother = PersonForm(prefix="mother") + >>> father = PersonForm(prefix="father") + >>> print mother.as_ul() + <li><label for="id_mother-first_name">First name:</label> <input type="text" name="mother-first_name" id="id_mother-first_name" /></li> + <li><label for="id_mother-last_name">Last name:</label> <input type="text" name="mother-last_name" id="id_mother-last_name" /></li> + >>> print father.as_ul() + <li><label for="id_father-first_name">First name:</label> <input type="text" name="father-first_name" id="id_father-first_name" /></li> + <li><label for="id_father-last_name">Last name:</label> <input type="text" name="father-last_name" id="id_father-last_name" /></li> + + Fields ====== |
