I am trying to create records using an inline formSet while at the same time creating a record with a normal form whose primary key is the foreign key for the inline formSet all on the same HTML page.
Make sense? Here's what I mean: Suppose I have the following two models (not real code, obviously, but you get the idea):
Class mainModel
Primary Key (custom pk I create)
field1
field2
Class inlineFormModel
autoPK
field1 = ForeignKey(mainModel)
field2
Now, I want to create a single HTML page for the user so they can create a mainModel instance at the same time as creating a number of inlineFormModel instances. The mainModel would be a normal form while the inlineFormModel would be using inlineFormsets. The problem is that when I save all the forms, there is no foreignKey to link to the inline formSet records since the model it refers to is still be created (everything gets saved in the same view). Does that make sense?
How would I go about creating a new mainModel instance with several secondModel instances and save the whole batch all with the same view function?
Thanks!