About Path Converters
Django URL configuration uses path() functions to map URL paths to views:
path(
"blog/<slug:post_slug>/",
views.post_details,
name="post_details",
),
These are the default types of URL components called path converters:
| Path Converter | Description |
|---|---|
| str | any string excluding "/" |
| int | zero or a positive number |
| slug | ASCII letters or numbers, hyphen, and underscore |
| uuid | formatted UUID |
| path | any string including "/" |
Custom path converters can be added too. More complex regular expressions can be implemented with re_path().
Tips and Tricks Programming Development Django 6.x Django 5.2 Django 4.2
Also by me
Django Messaging
For Django-based social platforms.
Django Paddle Subscriptions
For Django-based SaaS projects.
Django GDPR Cookie Consent
For Django websites that use cookies.