Django: Getting Started Transcripts
Chapter: Receiving Uploads in Django
Lecture: Using the Django Admin to upload an author's picture
Login or purchase this course to watch this video and the rest of the course contents.
0:01 In the background, I fired up the DEV server and here I am in the admin, I'll go to authors and add a new one.
0:17 The Django admin knows what to do with an image field. So when I add Ernest here, I can upload his photo.
0:28 Thanks to Wikimedia commons for the image source, which is in the sample codes, data directory for your convenience.
0:34 Let me just save Ernest and the author has been added. Let's go look at the uploads directory to see what happened when I created Ernest.
0:50 Great. You've got an uploaded image or is it great? Note, that it is named the same thing the user that, that would be me in this case,
0:58 named the file on their computer. What would happen if someone else came along and named their arthur Conan Doyle picture Hemingway.jpeg?
1:07 Well you'd overwrite the file and because the Hemingway image field merely points at the file name, you'd have an incorrect Hemingway bio.
1:16 Let's talk about what can be done about this.