| | 862 | |
|---|
| | 863 | |
|---|
| | 864 | Prefixes for forms |
|---|
| | 865 | ------------------ |
|---|
| | 866 | |
|---|
| | 867 | You can put several Django forms inside one ``<form>`` tag. To give each |
|---|
| | 868 | ``Form`` its own namespace you need to use the ``prefix`` keyword argument:: |
|---|
| | 869 | |
|---|
| | 870 | >>> mother = PersonForm(prefix="mother") |
|---|
| | 871 | >>> father = PersonForm(prefix="father") |
|---|
| | 872 | >>> print mother.as_ul() |
|---|
| | 873 | <li><label for="id_mother-first_name">First name:</label> <input type="text" name="mother-first_name" id="id_mother-first_name" /></li> |
|---|
| | 874 | <li><label for="id_mother-last_name">Last name:</label> <input type="text" name="mother-last_name" id="id_mother-last_name" /></li> |
|---|
| | 875 | >>> print father.as_ul() |
|---|
| | 876 | <li><label for="id_father-first_name">First name:</label> <input type="text" name="father-first_name" id="id_father-first_name" /></li> |
|---|
| | 877 | <li><label for="id_father-last_name">Last name:</label> <input type="text" name="father-last_name" id="id_father-last_name" /></li> |
|---|
| | 878 | |
|---|