Django: Getting Started Transcripts
Chapter: Posting Data
Lecture: Reviewing the chapter
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
You've now learned how to submit data through web forms. Let's review the chapter. You can restrict the values of fields in models two different way.
0:10
Either through validation arguments or through model constraints. Field validation is done by Django at the save step.
0:18
Whereas model constraints are enforced by the database. Data is submitted to your server using the http post method.
0:26
And the most common way of doing this is through an HTML form. The request parameter to a view has a method attribute that indicates what http
0:35
method was used for the call. You can use that to write views that take both get and post.
0:43
You also saw how to use model form objects as a quick way to create a form based on your Django models and you use them to do form processing.
0:52
Most form processing is done in a four step process. The user hits your view with a get method and retrieves the form usually empty.
1:02
Then they submit the form with their data using post. If the data is good they are redirected somewhere else or if the data is bad
1:11
they're sent back to the form with indications of their errors. Finally, although you've seen naming a URL
1:19
before for system URLs, I showed you how to name them yourself and look them up in your code.
1:25
Posting data isn't the only way of getting stuff to your server. In the next chapter, I'll cover how to upload files.