You'll sometimes want to accept media files. In this video, Nick walks through the right way to do this.
- A very great feature of forms … that we have not discussed yet is the ability … to take files that the user wants to upload to us, … whether it's going to be images or some sort of CSV data. … Whatever it is, we can accept that … into our project via forms. … If you're going to accept some sort of file, … there's a few different pieces … that we have to make sure are ready to accept it. … The first one is, we have to move to our order.html. … In our form, we have to specify that it's going … to be able to take this type of information. … In our form here, we'll just do it right before the action, … we'll say enctype =, … and then we're going to have this be equal to, … and look we already have the suggestion here, … we want multipart/form-data, meaning that the user … should be able to select some sort of file … and add it to the following form. … We've got to make that change, … we'll go ahead and hit Command + S, save that. … Then, if we're going to be … accepting images into our project, …
- 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.