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.

Formset views

Formset views

From the course: Django: Forms

Start my 1-month free trial

Formset views

- [Instructor] Now it's time to create a function for the pizzas view. So, let's go ahead and make that function. That's just going to be def pizzas. We'll go ahead and pass self into there. And with this pizzas, we hopefully are getting good information about the number of pizzas that people want, but maybe that's going to get spoofed or tricked somehow, so we're going to provide a default where we're going to say number of pizzas is going to be equal to two. Now hopefully what will happen is we'll say our filled_multiple_pizza_form, very descriptive here, is going to be equal to, our MultiplePizzaForm, and pass inside of there our request., all caps, GET. Okay, so hopefully that gives us a number that the user provided between two and six, but we've got to check and make sure that that's valid, so we're going to say if filled_multiple_pizza_form .is_valid, so if this is all good, then we're going to say, alright, well then the number of pizzas, if we've confirmed that, is just going…

Contents