diff options
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 ------------------------------------------- |
