In this video, see how to create pizza and size models.
- [Instructor] Once someone orders a pizza, … we actually want to make a note of it. … We want to save that into our database … saying, hey, someone picked the following pizza … with these toppings and this size, … so we need to go create a model … that will hold that pizza information. … So, let's go ahead and move over to our app here … inside of Pizza. … We're going to move to our models.py, … and inside of here we're going to create a new class. … And there's two different classes that we need to create. … The first one is the size of a pizza. … We don't want there to be an infinite amount of sizes, … we want to specify either it's small, medium, large, … or if you wanted to customize, … you can create your own, but we want a fixed amount. … So we're going to create a new Size class, … and this is going to come from models.Model. … Inside of this class, we want to have a title … for our particular size. … This is going to be a models.Charfield, … and with this we're going to specify …
- 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
Building RESTful Web APIs with Djangowith Rudolf Olah1h 9m 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.