Tag forms

Dynamic ModelForms in Django

Since 'newforms' became the norm within Django, there seems to have been some confusion relating to dynamic forms that relate specifically to a model.

The basic way to handle forms is to use a ModelForm for simple single-model-related forms, and Form instances for everything else, including more advanced Model-based forms. Many people seem to forget, however, that a ModelForm or Form instance can be manipulated after it's created.

In this blog post, I have included a design pattern I've recently used that should be of use to others who want to tweak their ModelForm instances at runtime.