Thursday, January 1, 2015

Re: FormSets with arbitary number of forms

The formset allow you create many instances of an object. What you need is the inline formset. When you create a Album, you can create one or more songs.

On Wed, Dec 31, 2014 at 4:59 PM, Some Developer <someukdeveloper@gmail.com> wrote:
I've been reading the documentation on FormSets and must admit that I am a bit confused.

I have a model called Album that contains many Songs. But when a user creates a new album I have no idea how many songs the Album will contain.

So I want to create a FormSet that has an Album form and many Song forms but I need the user to be able to decide how many Song forms there are in advance. Is this possible?

I might be misunderstanding the documentation but I couldn't see anything.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/54A447A2.4010804%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAGjPPHk3xZ3r_ugBLA_crVWe4dym8nd0-q029B_-A2fP%2BYS9Rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment