Re: Match from list in URLconf

2007-07-31 Thread Matt
Hi all, Thanks for all the feedback! I was expecting either a "do it like this" or a "sorry, it can't be done" type response - this is much better. Tim - my initial solution was to use a differentiator view as you suggested. I thought this was a little messy because it dragged URL logic into my

Re: Match from list in URLconf

2007-07-30 Thread Emanuele Pucciarelli
Il giorno 30/lug/07, alle ore 17:21, Matt ha scritto: > 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

Re: Match from list in URLconf

2007-07-30 Thread Tim Chase
> 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 --> g

Re: Match from list in URLconf

2007-07-30 Thread Brad Siegfreid
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

Re: Match from list in URLconf

2007-07-30 Thread Matt
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 -->

Re: Match from list in URLconf

2007-07-30 Thread Brad Siegfreid
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

Re: Match from list in URLconf

2007-07-30 Thread Emanuele Pucciarelli
Il giorno 30/lug/07, alle ore 01:17, Matt ha scritto: > 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? You should probably look at '

Re: Match from list in URLconf

2007-07-29 Thread Matt the Destroyer
I missed a quote, it should be: (r'^(?P\w+)/$', 'project.views.user_page') On Jul 29, 10:16 pm, Matt the Destroyer <[EMAIL PROTECTED]> wrote: > Perhaps try adding a URL pattern like the following: > (r^(?P\w+)/$', 'project.views.user_page') > > Your view function (called "user_page") wil

Re: Match from list in URLconf

2007-07-29 Thread Matt the Destroyer
Perhaps try adding a URL pattern like the following: (r^(?P\w+)/$', 'project.views.user_page') Your view function (called "user_page") will now accept "user_name" as an argument in addition to the request object. I should warn you that using that regular expression could be dangerous, as it