Models often are submitted by users. The ModelForm class makes this process really easy. Nick explores this further in this video.
- [Instructor] So, now that we have a new model, … we're going to create a new form that's based off that model … and it's going to saved us even more time … than we already save from creating this Django Form. … You're going to see, this is going to be really incredible. … So let's first go ahead … and comment out our pizza form class. … So, I'm going to select all that. … If I hit command and then forward slash and Adam, … it comments it out for me automatically. … Cool little trick there. … And then we want to make sure that, up at the top here, … we can say, from dot … and we want models to import … and let's go grab our pizza class. … Alright, so with this in place, … now we're going to be creating a form … that's called a special kind of form. … It's a form model or a model form, rather. … So, let's go ahead and say class pizza form. … Notice this is the exact same name that we have here, … so this won't disrupt any of our view code … or anything like that. … We're going to say pizza form …
- Creating form fields
- Using submitted data
- Adding models
- Using the ModelForms class
- Working with widgets
- Accepting files and multiple forms on a page
- Customizing formsets
- Using local validation
- Delivering errors responsibly
- Customizing forms
- Styling with CSS
Skill Level Intermediate
1. Getting Started with Forms
2. Working with Advanced Form Features
3. Customizing and Styling Form Appearance
Next steps1m 19s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.