Django: Getting Started Transcripts
Chapter: Django Admin
Lecture: Referencing Admin URLs

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Navigating your website is based on URLs, which end up all over the place. Different HTML pages inside of your views. It could get messy.
0:12 If you decide to make a change to one of these, you have to make sure you find all the references.
0:17 Just like you shouldn't have hard coded strings in your code. You shouldn't have hard coded URLs,
0:23 Django fixes this by providing a way to name your URLs and then reference them. If your URL isn't hard coded,
0:32 you can make a change later without too much cost. The only place the URL should show up as a string is in the file where it maps to the view.
0:44 Convientently this is where you name it as well. Following their own best practices that Django folks have named all of their admin URLs
0:52 This means you can reference the different parts of the admin from within your own code by referencing their names.
1:00 Recall the creation of the author last name field in the book admin. I used a callable to specify the contents of a column in the change listing.
1:09 You can go one step further and make that a link allowing you to click through to a related object. Let's go do that.

Talk Python's Mastodon Michael Kennedy's Mastodon