I'm trying to think of how I would make a purchase order app, where the purchase order itself has its details/information (vendor name, shipping type, payment terms, etc.) but it also has an unspecified (could be 1, could be 10, could be 20) actual purchase items with their own details/information (qty., description, price per unit, etc.).
Pretty sure on the model side I would just make two seperate models, one for purchase orders and one for purchase items with a ForeignKey to relate the purchase items back to its corresponding purchase order, but on the view side (I'm using CBVs) would you just include both models in the CreateView/UpdateView/DeleteView? And on the template side I'm having trouble thinking how this would work, other than first creating your purchase order, then having some sort of frankenView for the purchase order DetailView/CreateView for purchase items. Thats the only solution I can think of without a bunch of fancy AJAX to put a form for the purchase items inside the CreateView form for the purchase order. Does anyone know of a better way to do this?? Thanks!