mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #24788 -- Allowed Forms to specify a prefix at the class level.
This commit is contained in:
parent
4ccfc4439a
commit
4df7e8483b
4 changed files with 28 additions and 1 deletions
|
@ -1065,3 +1065,13 @@ You can put several Django forms inside one ``<form>`` tag. To give each
|
|||
>>> 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>
|
||||
|
||||
The prefix can also be specified on the form class::
|
||||
|
||||
>>> class PersonForm(forms.Form):
|
||||
... ...
|
||||
... prefix = 'person'
|
||||
|
||||
.. versionadded:: 1.9
|
||||
|
||||
The ability to specify ``prefix`` on the form class was added.
|
||||
|
|
|
@ -161,6 +161,9 @@ Forms
|
|||
:attr:`~django.forms.Form.field_order` attribute, the ``field_order``
|
||||
constructor argument , or the :meth:`~django.forms.Form.order_fields` method.
|
||||
|
||||
* A form prefix can be specified inside a form class, not only when
|
||||
instantiating a form. See :ref:`form-prefix` for details.
|
||||
|
||||
Generic Views
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue