Django: Getting Started Transcripts
Chapter: Django ORM and Databases
Lecture: Introducing data loading fixtures
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Great. So you've got some models. You've got the corresponding tables. Now you probably want to play with more data.
0:07
Rebel is great and all but typing books in individually could take a while depending on the size of your library.
0:13
Good thing that Django provides some more management commands to assist you with this. The chunks of data you import and export are called fixtures.
0:22
You have several different options for the format of these fixtures, including two variants on JSON, XML YAML.
0:30
As long as you install the PyYAML library as well. The serialization is pretty much exactly as you would find things in your database.
0:37
That means that the primary keys in the data end up being hard coded. This can be a bit painful if you're doing edits by hand in your serialized data
0:46
As object relationships are all specified with those primary keys. Let's go back into the shell and play with some fixtures.