> For instance, if you also had categories of users and wanted to be > able to list the users in each category, a 'human-friendly' url > scheme might look like this: > > www.mysite.com/users/matt --> go to my area > www.mysite.com/users/jess --> go to Jess' area > www.mysite.com/users/mark --> go to Mark's area > www.mysite.com/users/premium --> list all premium members > www.mysite.com/users/economy --> list all economy members > > It's a contrived example, but if the categories were also numerous and > data-driven, you'd need a different solution to those mentioned. I > could always use "www.mysite.com/users/categories/premium", but it > doesn't have quite the same feel.
Depending on how many categories you had, you could try one of the following - create a specific URL in your urls.py for each of the handful of known categories, putting them the before the catch-all URL that treats it like usernames. This would prevent users from having a username like "premium" or "economy"...for better or worse :) - similar to the first, but accomodating data-driven categories, you could dispatch to a view that first tries to find a matching category and then falls back to a user-name...something like def view_whatever(request, target): try: cat = Category.objects.get(name=target) return view_category(request, cat) except: user = User.objects.get(username=target) return view_user(request, user) - create a different URL like your describe, though dislike for "not having quite the same feel" - provide a setup where example.com/users/ is the URL of the *collection* of users rather than the individual users, and then takes GET parameters for filtering/sorting, so you could have example.com/users/?cat=bigbucks example.com/users/?cat=premium example.com/users/?cat=economy example.com/users/?cat=cheapskate This last one also makes it nicely accessible from <form> elements if you need. Just my meandering thoughts on the matter. -tim --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---