When I mark to delete the formset, django requires complete all fields, he does not ignore the marked form to delete.

102 views
Skip to first unread message

Neto

unread,
Mar 26, 2015, 7:17:13 PM3/26/15
to django...@googlegroups.com
When I mark to delete the formset, django requires complete all fields, he does not ignore the marked form to delete. How do I solve this? I wanna that django delete the form marked or ignore him.

from django.forms.formsets import formset_factory
>>> from myapp.forms import ArticleForm
>>> ArticleFormSet = formset_factory(ArticleForm, can_delete=True, min_num=1, extra=0)

<form method="post" action="">
    {{ formset.management_form }}
    {% for form in formset %}
        <ul>
            <li>{{ form.title }}</li>
            <li>{{ form.pub_date }}</li>
            {% if formset.can_delete %}
                <li>{{ form.DELETE }}</li>
            {% endif %}
        </ul>
    {% endfor %}
</form>

aRkadeFR

unread,
Mar 27, 2015, 5:15:03 AM3/27/15
to django...@googlegroups.com
Thanks for the code paste.

You mean in your views, the formset.is_valid() returns False
and so does not delete your form tagged to delete?

I don't quite understand where exactly is the problem?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ecb3486-818c-4051-84e2-168b506b5c10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages