Ticket #16126: 16126_formset_delete_order.patch

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

patch with "if" and with information about can_order

  • docs/topics/forms/modelforms.txt

     
    829829    ``inlineformset_factory`` uses ``modelformset_factory`` and marks
    830830    ``can_delete=True``.
    831831
     832.. highlight:: html+django
     833
     834If you manually render fields in the template, you can render
     835``can_delete`` parameter with ``{{ form.DELETE }}``::
     836
     837    <form method="post" action="">
     838        {{ formset.management_form }}
     839        {% for form in formset %}
     840            {{ form.id }}
     841            <ul>
     842                <li>{{ form.title }}</li>
     843                {% if formset.can_delete %}
     844                    <li>{{ form.DELETE }}</li>
     845                {% enif %}
     846            </ul>
     847        {% endfor %}
     848    </form>
     849
     850Similarly, if the formset has the ability to order (``can_order=True``), it is possible to render it
     851with ``{{ form.ORDER }}``.
     852
     853.. highlight:: python
     854
    832855More than one foreign key to the same model
    833856-------------------------------------------
    834857
Back to Top