Django

Code

Changeset 6532

Show
Ignore:
Timestamp:
10/18/07 23:47:07 (1 year ago)
Author:
gwilson
Message:

Fixed #5666 -- Documented the prefix keyword argument for newforms.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/newforms.txt

    r6454 r6532  
    860860    <li>Instrument: <input type="text" name="instrument" /></li> 
    861861    <li>Haircut type: <input type="text" name="haircut_type" /></li> 
     862 
     863 
     864Prefixes for forms 
     865------------------ 
     866 
     867You 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 
    862879 
    863880Fields