Monday, April 23, 2012

Re: Ignoring empty forms in a formset

You will want to edit the management form values on the client side, as described in the documentation.

On Mon, Apr 23, 2012 at 15:42, Martin Tiršel <martin.tirsel@gmail.com> wrote:
Nobody knows how to ignore empty forms in a formset? I have to write some custom method on a form that checks all fields and returns False if any of the fields is filled or is there any other solution?

Martin

On Sunday, April 22, 2012 6:44:53 PM UTC+2, Martin Tiršel wrote:
Hello,

I have a formset and some JavaScript to add more forms into this formset. In a view, I iterate through the formset saving (not a ModelForm just Form with save method) each form:

for form in formset:
    form.save()

But I want to ignore empty forms that were added by JavasScript and not removed. How can I do this?

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Y_DfzKjYiYwJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Marcin Tustin
Tel: 07773 787 105

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment