Say I am collecting residence history and I allow the user to submit up to 
five previous addresses. I have a PEOPLE model and RESIDENCES model and 
anticipate a many-to-many relationship between. Back when I was working 
with Joomla I would have manages these models (well, tables) with a table 
in the middle called PEOPLE_RESIDENCES which would have also included the 
dates of that relationship. And I understand that I can do that with a 
model and the 'through' statement.

But here is where I'm lost. When I get a form submitted from the user, how 
do I get all the correct rows written to the various tables. Assume for 
simplicity sake that I have a new person being submitted as follows

PERSON
--RESIDENCE 1, 2005-2008
--RESIDENCE 2, 2008-2011
--RESIDENCE 3, 2012-2016

So I would need one new row on the PEOPLE table, three new rows on the 
PEOPLE_RESIDENCES table and up to three new rows on the RESIDENCES table. 
I'm lost on how the necessary rows are added to the PEOPLE_RESIDENCES 
table. Is there some sort of value returned from the create/insert 
statements or do I send the ORM a structured object which manages all of 
the INSERTS including the relatioinships? Or is there something else I have 
to do?

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2987a536-7d42-4440-ab56-e9a54326e4f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to