#need help understanding path

8 messages · Page 1 of 1 (latest)

rigid abyss
steady sage
#

You as a developer can choose any name you like for a URL.

rigid abyss
#

i see but why doesnt it show on the url

#

it shows book/1 instead of book/book-detail

valid hull
#

The first argument to path shows the URL path you've defined. In this case, it's book/<int:pk>, so that's what the URL shows. The name parameter is for your code internals only, if you need to refer to that URL path somewhere in the code (such as using the reverse function or the url template tag)

rigid abyss
#

what do you guys suggest for tutorial

valid hull
#

The <int:pk> is a placeholder in the path, which basically says "when you see the word book/ followed by an integer in a URL, call the BookDetailView, passing that integer as the pk parameter"

valid hull