Ticket #16126: 16126_formset_can_delete.patch

File 16126_formset_can_delete.patch, 899 bytes (added by Aleksandra Sendecka <asendecka@…>, 13 years ago)

rendering manually can_delete parameter in template

  • 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                <li>{{ form.DELETE }}</li>
     844            </ul>
     845        {% endfor %}
     846    </form>
     847
     848.. highlight:: python
     849
    832850More than one foreign key to the same model
    833851-------------------------------------------
    834852
Back to Top