Recently, I found myself trying to create a model form with fields spanning multiple models. I knew I could just re-define the fields manually, but that makes for poor maintainability (read: too lazy to type).
After some digging in ModelFormMetaclass
and modelform_factory()
, here's what I came up with:
from ...