FormSets with arbitary number of forms

21 views
Skip to first unread message

Some Developer

unread,
Dec 31, 2014, 2:00:17 PM12/31/14
to django...@googlegroups.com
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.

Edgar Gabaldi

unread,
Jan 1, 2015, 2:54:55 PM1/1/15
to django...@googlegroups.com
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.



--
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...@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.

Some Developer

unread,
Jan 2, 2015, 9:05:01 PM1/2/15
to django...@googlegroups.com
On 01/01/15 19:52, Edgar Gabaldi wrote:
> 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.
>

Ah!

Thank you. I must have missed that. I'll check it out.
Reply all
Reply to author
Forward
0 new messages