diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-06-17 15:39:28 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-06-17 15:39:28 +0000 |
| commit | 2a122be0fc92f12df16eeac65c9dc48516cf499a (patch) | |
| tree | d2e390ad060d3910764f76599d42bf0fc54baaef /docs | |
| parent | 98a69a2c0a9d6a57cc637b0e9a998495fc0bcbd7 (diff) | |
Fixed #16126 -- Added documentation about DELETE and ORDER fields in formsets. Many thanks to Aleksandra Sendecka.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16430 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 27 | ||||
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index a3721fdcdf..3faf6e584f 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -424,6 +424,33 @@ with the management form: The above ends up calling the ``as_table`` method on the formset class. +.. _manually-rendered-can-delete-and-can-order: + +Manually rendered ``can_delete`` and ``can_order`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you manually render fields in the template, you can render +``can_delete`` parameter with ``{{ form.DELETE }}``: + +.. code-block:: html+django + + <form method="post" action=""> + {{ formset.management_form }} + {% for form in formset %} + {{ form.id }} + <ul> + <li>{{ form.title }}</li> + {% if formset.can_delete %} + <li>{{ form.DELETE }}</li> + {% enif %} + </ul> + {% endfor %} + </form> + + +Similarly, if the formset has the ability to order (``can_order=True``), it is possible to render it +with ``{{ form.ORDER }}``. + Using more than one formset in a view ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 031408a151..feebbeb239 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -831,6 +831,10 @@ a particular author, you could do this:: ``inlineformset_factory`` uses ``modelformset_factory`` and marks ``can_delete=True``. +.. seealso:: + + :ref:`Manually rendered can_delete and can_order <manually-rendered-can-delete-and-can-order>`. + More than one foreign key to the same model ------------------------------------------- |
