I feel like I'm spending as much time designing URLs for this same problem as I do handling other aspects of software architecture. The simplest solution for this case would be a user/matt for mapping to specific users and users/premium for retrieving a collection of users in a category. Subtle but clear and attractive. Easy to map to different handlers.
I've been using singular for specific resources and plural for collections and it maps well. On 7/30/07, Matt <[EMAIL PROTECTED]> wrote: > > > Hi everyone, > > Thanks for the suggestions. The problem is a little more subtle than > my example suggested. > > 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. > > > > On Jul 30, 3:56 pm, "Brad Siegfreid" <[EMAIL PROTECTED]> wrote: > > If all you have is a list of users to look through the suggestions work > just > > fine. Otherwise, it's easier to set a common root for that particular > > lookup, such as mysite.com/user/matt. This avoids the problem of mixing > in a > > variable URL value with other parts of your site. It also maps nicely to > a > > Django app as well. > > > > On 7/29/07, Matt <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hello list, > > > > > I was wondering if the following is possible with the URLconf: > > > > > I'd like the URL regex to match part of a URL if it exists within a > > > specific list of values. For example, if you wanted to direct users to > > > their area of your site, you might have something like this: > > > > >www.mysite.com/matt--> go to my area > > >www.mysite.com/jess--> go to Jess' area > > >www.mysite.com/mark--> go to Mark's area > > > > > In this situation you'd want a URL match for every user on your site, > > > which is obviously database driven. I'd like to be able to pull a list > > > of all the users out of the database and use a single line in my > > > URLconf to acheive the above. > > > > > This could all be acheived using another view to determine whether the > > > given name was a valid user, and if so direct you to the appropriate > > > view, but wouldn't that prevent you using Django's generic views? > > > > > Thanks, > > > Matt. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---