Django: Getting Started Transcripts
Chapter: Django ORM and Databases
Lecture: Chapter review
Login or purchase this course to watch this video and the rest of the course contents.
0:00 Tired of databases yet? Let's review everything covered in the chapter. Django has an ORM built in.
0:07 It uses Python classes to define database table structures and instances of those objects as rows in the database.
0:16 To create a model you inherit from models.model class, and use fields from the same module to define the columns in the table
0:25 There are a couple of dozen fields that map to SQL data tapes and for the most part are represented in the object by similar Python data types.
0:35 There are a special set of columns that specify relationships between objects which map to foreign keys in the database.
0:43 Django provides a set of commands and automatically generated scripts for
0:47 managing the changes to the database that correspond to changes you make in your objects. This is called migration.
0:54 There'll be more on this in a future chapter. Once your table structure exists, you can get data out and put data in through the use of fixture files.
1:03 These are serialized text representations of your data. And finally, Django automatically creates you a clean database
1:12 so that you know the state of the system you're testing. Special methods on the test class,
1:16 provide for the creation of data on each execution of a test method.
1:22 Django comes packaged with a powerful tool that gives you a way of managing all your data through a web based interface.
1:27 It's called the Django admin, and that's what we will be covering in the next chapter.