Wednesday, October 13, 2010

Nesting related object in formset

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

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate