filmov
tv
Django URLs - Named URLS, url template-tag, Reversing URLs, URL namespaces, & get_absolute_url()

Показать описание
In this video we'll dive into some core URL-related concepts in Django. We'll see how to give our URLs names that can then be used in other Django utilities.
We'll see how to use these with the "url" template-tag to generate links in our Django templates, and with the reverse() function for building URLs in our Python code.
We'll also see how to namespace URLs in applications within our Django project, and how to refer to these namespaced URLs with the above tools.
Finally, we'll demonstrate use of the get_absolute_url() function in Django - a model method that should return the canonical URL for an object in your database.
BONUS: we'll see the django-extensions "show_urls" command to get command-line information on the URLs in use in our project (including third-party URLs).
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:25 Adding Navbar with hard-coded links
05:08 Generating links with the URL template-tag
06:23 Adding Booklist with dynamic URL parameter
09:41 Using named URLs with the reverse() function
13:55 Namespacing URLs in Django
19:39 get_absolute_url() Model Function
23:05 django-extensions show_urls command
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
▶️ Full Playlist:
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
#django #python
We'll see how to use these with the "url" template-tag to generate links in our Django templates, and with the reverse() function for building URLs in our Python code.
We'll also see how to namespace URLs in applications within our Django project, and how to refer to these namespaced URLs with the above tools.
Finally, we'll demonstrate use of the get_absolute_url() function in Django - a model method that should return the canonical URL for an object in your database.
BONUS: we'll see the django-extensions "show_urls" command to get command-line information on the URLs in use in our project (including third-party URLs).
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:25 Adding Navbar with hard-coded links
05:08 Generating links with the URL template-tag
06:23 Adding Booklist with dynamic URL parameter
09:41 Using named URLs with the reverse() function
13:55 Namespacing URLs in Django
19:39 get_absolute_url() Model Function
23:05 django-extensions show_urls command
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
▶️ Full Playlist:
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
#django #python
Комментарии