Code

Ticket #5666: newforms_prefix.diff

File newforms_prefix.diff, 802 bytes (added by anonymous, 7 years ago)
Line 
1Index: docs/newforms.txt
2===================================================================
3--- docs/newforms.txt   (Revision 6456)
4+++ docs/newforms.txt   (Arbeitskopie)
5@@ -860,6 +860,21 @@
6     <li>Instrument: <input type="text" name="instrument" /></li>
7     <li>Haircut type: <input type="text" name="haircut_type" /></li>
8 
9+
10+Prefixes for Forms
11+------------------
12+
13+You can put several Django Forms between one ``<form>`` tag. To give
14+each Form its own namespace you need to use the keyword argument
15+``prefix``. If you want to use several PersonForms in one HTML form::
16+
17+    >>> mother=PersonForm(prefix="mother")
18+    >>> father=PersonForm(prefix="father")
19+    >>> print father.as_ul()
20+    <li>First name: <input type="text" name="father-first_name" /></li>
21+    ...
22+
23+
24 Fields
25 ======
26