From the course: Django: Forms

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Model forms

Model forms

From the course: Django: Forms

Start my 1-month free trial

Model forms

- [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 is coming from lowercase forms dot…

Contents