Posted 7:22 p.m., Monday 15 December, 2008.
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.
Want to see more? Check out the yearly archives below.
© Copyright 2006- Ross Poulton. All Rights Reserved unless explicitly defined.
Opinions expressed here are my own, and not those of my employer or any other party.