Opened 4 years ago

Closed 4 years ago

#16126 closed Cleanup/optimization (fixed)

please add information on rendering DELETE checkbox manually for formset

Reported by: tim@… Owned by: ethlinn
Component: Documentation Version: master
Severity: Normal Keywords: dceu2011
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-the-formset-in-the-template

<form method="post" action="">
    {{ formset.management_form }}
    {% for form in formset %}
        {{ form.id }}
        <ul>
            <li>{{ form.name }}</li>
            <li>{{ form.age }}</li>
            <li>{{ form.DELETE }}</li>   <!--  ** Something like this ** -->
        </ul>
    {% endfor %}
</form>

http://stackoverflow.com/questions/2635410/

Attachments (3)

16126_formset_can_delete.patch (899 bytes) - added by Aleksandra Sendecka <asendecka@…> 4 years ago.
rendering manually can_delete parameter in template
16126_formset_delete_order.patch (1.1 KB) - added by Aleksandra Sendecka <asendecka@…> 4 years ago.
patch with "if" and with information about can_order
16126_formset_delete_order_links.patch (1.7 KB) - added by Aleksandra Sendecka <asendecka@…> 4 years ago.
changes moved to formset to "Using a formset in views and templates" section. Link from previous location added in "See also"

Download all attachments as: .zip

Change History (12)

comment:1 Changed 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

comment:2 Changed 4 years ago by Aleksandra Sendecka <asendecka@…>

  • Owner changed from nobody to ethlinn
  • UI/UX unset

Changed 4 years ago by Aleksandra Sendecka <asendecka@…>

rendering manually can_delete parameter in template

comment:3 Changed 4 years ago by anonymous

I would also add a check for can_delete something like

{% if formset.can_delete %}
    {{ form.DELETE }}
{% endif %}

And maybe, if it isn't out of scope add the same docs for can_order and form.ORDER

comment:4 Changed 4 years ago by rasca

Oups, that was me :)

Changed 4 years ago by Aleksandra Sendecka <asendecka@…>

patch with "if" and with information about can_order

comment:5 Changed 4 years ago by rasca

Checking in more detail, I think this should be in https://docs.djangoproject.com/en/dev/topics/forms/formsets/#can-order and in https://docs.djangoproject.com/en/dev/topics/forms/formsets/#can-delete . And maybe and example in each?

And in https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets can_delete can link to formsets/#can-delete.

What do you think?

comment:6 Changed 4 years ago by Aleksandra Sendecka <asendecka@…>

Changed 4 years ago by Aleksandra Sendecka <asendecka@…>

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

comment:7 Changed 4 years ago by oinopion

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 Changed 4 years ago by oinopion

  • Keywords dceu2011 added

comment:9 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16430]:

Fixed #16126 -- Added documentation about DELETE and ORDER fields in formsets. Many thanks to Aleksandra Sendecka.

Note: See TracTickets for help on using tickets.
Back to Top