You can prevent bad data being sent to you by using local validation for your users. In this video, walk through how you can work with browsers to make this happen.
- [Narrator] When it comes to validating your data, … Django forms really helps you go far … with a little bit of code. … You know some of the specifications that we … have for our data, for instance … we have said that we want toppings to be … no bigger than 100 each. … We can see that code, if we go ahead and move over … to our models.py and confirm that each of these … has to be 100. … So you'll notice if we go back to our … main order page here, if I try and … order something without filling out the toppings: … One, it will say "Hey you've got to fill out … this field with something here" … So we can go ahead and put something there … "Oh, no now you're missing two" … and even if I leave this size out, … it' going to complain here. … So all of these things, all these little … pop-ups you just saw, this is local validation. … Meaning this is all happening on the browser, … none of the code on our server has said … "Hey this needs to happen" and in fact … if you go ahead and inspect the code here, …
- 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.