I recently decided to try Django for a project at work and discovered that it really has trouble with complex forms. I needed a combination of nested InlineFormSet objects and the ability to add to the form set dynamically. Neither of those things are clearly covered in the Django documentation or as easy as I would have expected. I still don't have it working, but here's what I got so far in case anyone else is working on the same thing.

For the nested form sets I came across this blog post which was very helpful. It needed a couple of minor changes, at least one of which was because my nested form sets were for FileField objects.

For the addition of form sets I used this technique since I believe in making a site work without JavaScript first and then adding fancy JavaScript that degrades gracefully where it makes sense. It appears this would have worked if not for the nested form sets above. Unfortunately, when adding an outer form set, I would get an error about the management form being missing or tampered with on the new inner form set. I have not yet figured out how to make that stop.