Django: Getting Started Transcripts
Chapter: Custom Django Commands
Lecture: Running the 'authors' command

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I'm inside my trusty terminal. Let me start by running the management command without any arguments. Let me just scroll up here.
0:12 Remember if you're on Windows, you'll have to be less lazy than I and type out the whole Python to get this to run.
0:20 The result of without a subcommand is a list of all of the commands grouped by the app that defines them.
0:27 The second grouping here is the catalog app and the newly minted authors command. Okay, now that you've seen that, let me run the command itself.
0:41 Calling the authors command prints out a list of the author's last name, first name, if there is one, birth year, and some info about their picture,
0:50 file name, remember how I said there was help. Let's see that. There's a lot here and that's because the base command is providing all
1:01 sorts for you automatically. You can manage django settings, you can modify the Python path, you can decide whether or not to use colorized output.
1:10 All that comes for free by inheriting from base command because there's so much help info it would be easy to miss this line that I've highlighted,
1:18 but it is that help attribute that you defined in the class. If your command had arguments,
1:23 additional information about them would show up here as well. Let's go write just such a command.

Talk Python's Mastodon Michael Kennedy's Mastodon