Main question is whether there is any method to bundle many django forms into single instance, to make clear what I need to explain my problem:
I have created bunch of form classes that need to work together to display a single view.
from_form = move_forms.WaypointForm(prefix="marker-from", instance=move.from_place)
to_form = move_forms.WaypointForm(prefix="marker-to", instance=move.to_place)
#Notice that last two form are of the same class
through = ThroughFormset(prefix="through", queryset=move.waypoints_db.all())
path_form = move_forms.CarMovePathForm(path=move.path)
date_form = move_forms.MoveForm(instance=move)
#put all this into context instance and render
All these forms basically display/edit the same instance of database — but are reused throught the app in different configurations (so I cant just manually create class that will encapsulate it).
Having many forms in a webpage is a nuisance, for example I have to write code like that:
if transportation_form.is_valid() and from_form.is_valid() and \
to_form.is_valid() and through.is_valid() and path_form.is_valid():
I can’t pass cleanly form property to views since most vievs use many forms in such manner.
Is there any sensible way to bundle these forms — or is just my design broken (if so how to fix it).
What about this