Entries published on November 25, 2007
Newforms, part 3
Now that I’ve got the user-profiles application out in the wild, let’s take a look at one last important feature of Django’s newforms
library: the ability to dynamically generate forms “on the fly” from model classes, via the helper functions form_for_model
and form_for_instance
. And, just as importantly, let’s look at why they shouldn’t always be the first thing you reach for when you need to build a form.
How model-generated forms work
We’ve already taken a look at how to introspect Django models using Django’s own internal APIs, and if you’ve been following along with my posts this month you’re …