Ok, best practices time.

Segments:
Only introduces a new segment if it indicates a page that is a logical
descendant of the previous, traversing a category hierarchy would be
the typical example

/books/thrillers/

Query Parameters:
Used to define the viewing parameters of the current level in the
hierarchy, you'd use this for sorting, pagination and arguably
filters.

/books/thrillers?page=2&sort=a-z&hide=discontinued

It might not look pretty, but this is the way URL syntax works, now
you could arguably have 'discontinued' as another url segment but once
you start down that line of thought you end up with some fairly deep
url structures that could logically be in any order (creating a huge
number of possible combinations)

I typically overload a single level in the hierarchy with multiple
functions by using different slug formats to differentiate between
different view functions. You end up with some limitations but you
keep fairly short and logical URLs.

Regards,
Andrew Ingram


2009/4/16 Marcin Mierzejewski <marcin.mierzejew...@gmail.com>:
>
> Hi Aidas,
>
>> 7. Using the controlling words before the type of list:
>>     /by-popularity/products/
>>     /featured/products/
>>     /page5/products/
>>     /add/products/
>>     /products/myproduct/
>>     /products/myanotherproduct/
>
> 8. Using parameters
>     /products/?sort=popularity
>     /products/?filter=featured
>     /products/?page=5
>     /products/add/
>     /products/myproduct/
>     /products/myanotherproduct/
>
> Best regards,
> Marcin
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to