Django: Getting Started Transcripts
Chapter: Users and Account Management
Lecture: Register profile URL patterns
Login or
purchase this course
to watch this video and the rest of the course contents.
0:17
The only thing in this file you haven't seen before is on line 9. Up until now you've been using URLs without arguments.
0:25
Line 9 defines the profile URL which maps to a profile view. You'll remember that view took a single argument.
0:33
The id of a profile to show the angle brackets here tell the URL mapper that this is where an argument goes.
0:42
Inside of the angle brackets is a data type and the name of the argument. The data type is actually really handy. All URLs technically are strings.
0:52
But by putting a data type here, Django will one make sure that the URL is using a valid integer and two convert it to an integer
1:00
before calling the view, so you don't have to do this yourself. And like with the catalog app before I need to include the people URLs file that
1:10
I just created in the master alexandria URLs file to register all the sub URLs All right. I'm all set to go. Let me start the server.