Nesting related object in formset

7 views
Skip to first unread message

Preston Holmes

unread,
Oct 14, 2010, 1:59:48 AM10/14/10
to Django users
I'm pretty comfortable with the concept of mixing multiple objects in
one form. But I have a case where I have a model formset and want to
add a form field that represents a field from a related model, such
that the related model can be created if it is filled out.

As a simple example:

I have a person object and a related pet object

I have a person formset, and I want to have a field in each form:
"pet's name". If that is filled out, I want to create a pet object in
the related object manager.

The closest I've found is http://yergler.net/blog/2009/09/27/nested-formsets-with-django/

which deals with a nested formset. I'm wondering if there is
something simple to deal with just a nested object represented by a
single field.

-Preston
Reply all
Reply to author
Forward
0 new messages