routing

Django URL namespacing and reverse lookups

URL namespaces prevent name collisions across apps. I set app_name in app-level urls.py and use namespace in include(). Reverse lookups use reverse('namespace:name') or {% url 'namespace:name' %} in templates. This makes URLs maintainable when refacto

Django REST Framework nested routers

Nested routers create hierarchical URL structures for related resources. I use drf-nested-routers to define parent-child relationships in URLs like /posts/1/comments/. This makes APIs more RESTful and intuitive. I filter child resources by parent ID i