About URL Path vs. Query Parameters

When in doubt whether to use URL path or query parameters, follow this rule:

  • Use URL path to uniquely define resources: list views, detail views, form views.

    1
    2
    3
    /jobs/
    /blog/2022/02/hello-world/
    /contact/
    
  • Use query parameters to define how the resource is displayed: item list or item grid, page 1 or page 10, web view or print view.

    1
    2
    3
    /profiles/?show=grid
    /profiles/?page=10
    /profiles/?media=print
    

Tips and Tricks Web Design Architecture Django 5.x Django 4.2 Django 3.2