worked for me using the following:

[urls.py] (i removed the single quotes around the view)
from myapp.views import showline
(r'^(?P<manufacturer>[a-zA-Z-]+)_(?P<line>[\w-]+)/$', showline),

[views.py]
def showline(request, manufacturer, line):
   return HttpResponse('manu = ' + manufacturer + '<br />line = ' +
line)

Maybe the error is being generated from somewhere else?


On Jan 1, 9:42 pm, Greg <[EMAIL PROTECTED]> wrote:
> ocgstyles,
> I tried the following however I'm still getting a page not found
> error:
>
> (r'^(?P<manufacturer>[a-zA-Z-]+)_(?P<line>[\w-]+)/$', 'showline'),
>
> On Jan 1, 8:23 pm, ocgstyles <[EMAIL PROTECTED]> wrote:
>
> > Hi Greg,
>
> > The problem is that "\w" is consuming the underscore.  Instead of
> > using [\w-], use [a-zA-Z-].  The pattern would then look like:
>
> > (r'^(?P<manufacturer>[a-zA-Z-]+)_(?P<line>[\w-]+)/$', 'showline')
>
> > Hope that helps.
>
> > Keith
>
> > On Jan 1, 9:05 pm, Greg <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
> > > I orginially had my url like this:
>
> > > (r'^(?P<manufacturer>[\w-]+)/(?P<line>[\w-]+)/$', 'showline')
>
> > > Which would work fine when going to the url 'www.mysite.com/sprint/
> > > cellphone/'
>
> > > //////////////
>
> > > However, I want to change my url structure so that all of my pages are
> > > as close to the root as possible.  So I replaced my '/' in the url
> > > with a '_'.  Like so:
>
> > > (r'^(?P<manufacturer>[\w-]+)_(?P<line>[\w-]+)/$', 'showline')
>
> > > However, I now get a page not found whenever I view the following url
> > > 'www.mysite.com/sprint_cellphone/'
>
> > > ////////
>
> > > Can I not replace the / with a _ in my url?
>
> > > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to