Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 2a122be0fc92f12df16eeac65c9dc48516cf499a 1 parent 98a69a2
@jezdez jezdez authored
Showing with 31 additions and 0 deletions.
  1. +27 −0 docs/topics/forms/formsets.txt
  2. +4 −0 docs/topics/forms/modelforms.txt
View
27 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
View
4 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
-------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.