Hi,
I’m using django forms for the first time.
As long as you use a single model for a form and no extra fields, it’s pretty straight forward.
But what if I want to use a few extra fields in a particular form?
Example with 3 models:
- User
- Organization
- Affiliation (relationship between Users and Organizations) – a user can have more than one affiliation
The create form is for a new user only.
Because it’s a new user, I want to be able to add an affiliation right away in the same form instead of making it in 2 steps. This implies that the user info will be saved in the user table (without the organization ID which doesn’t belong there). After the new User is saved, I need to grab the new user’s ID and the organization’s ID to populate the Affiliation table in one fell swoop.
I don’t know how to accomplish that. And, is it possible the way I’m describing it? Is there a better way?
Any help would be greatly appreciated.
No code, just high level explanation/concept would be enough.
Thanks,