Ticket #16126: 16126_formset_delete_order_links.patch

File 16126_formset_delete_order_links.patch, 1.7 KB (added by Aleksandra Sendecka <asendecka@…>, 13 years ago)

changes moved to formset to "Using a formset in views and templates" section. Link from previous location added in "See also"

  • docs/topics/forms/formsets.txt

     
    424424
    425425The above ends up calling the ``as_table`` method on the formset class.
    426426
     427.. _manually-rendered-can-delete-and-can-order:
     428
     429Manually rendered ``can_delete`` and ``can_order``
     430~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     431
     432If you manually render fields in the template, you can render
     433``can_delete`` parameter with ``{{ form.DELETE }}``:
     434
     435.. code-block:: html+django
     436
     437    <form method="post" action="">
     438        {{ formset.management_form }}
     439        {% for form in formset %}
     440            {{ form.id }}
     441            <ul>
     442                <li>{{ form.title }}</li>
     443                {% if formset.can_delete %}
     444                    <li>{{ form.DELETE }}</li>
     445                {% enif %}
     446            </ul>
     447        {% endfor %}
     448    </form>
     449   
     450
     451Similarly, if the formset has the ability to order (``can_order=True``), it is possible to render it
     452with ``{{ form.ORDER }}``.
     453
    427454Using more than one formset in a view
    428455~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    429456
  • docs/topics/forms/modelforms.txt

     
    829829    ``inlineformset_factory`` uses ``modelformset_factory`` and marks
    830830    ``can_delete=True``.
    831831
     832.. seealso::
     833
     834    :ref:`Manually rendered can_delete and can_order <manually-rendered-can-delete-and-can-order>`.
     835
    832836More than one foreign key to the same model
    833837-------------------------------------------
    834838
Back to Top