Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Django gives us a really handy way to quickly build forms based on our existing models.
Model forms are probably the part of the forms
library that you'll use more than any other.
One of the areas of model forms that frustrates people, but is amazingly important, is the requirement to use either fields
or exclude
. Many people find excludes
to be faster, simpler, easier because you don't have to update it every time you change your form or your model. But that's a dangerous decision to make because now any new fields will be automatically added to your displayed form. So use fields
instead! Be explicit and control your fields directly by using the fields
attribute!
You need to sign up for Treehouse in order to download course files.
Sign up