On Mon, Sep 21, 2009 at 3:28 PM, Malcolm MacKinnon <mmack3...@gmail.com>wrote:
> Hi, > I'm new to Django. > I keep getting a 404 error when I try to pass a "prod" parameter to a url. > I think it is just this last parameter that is giving me trouble. > > Here is my error: > Page not found (404) > > Request Method:GET > Request > URL:http://localhost/order_closeouts/imgs/WMS%20DIVA%20PANT%20BLK/Here's > my url: > > (r'^order_closeouts/(?P<foo>\w{4})/(?P<prod>)w+/$', > 'onhand.views.order_closeouts', ), > > First, the closing paren for the "prod" capture needs to be after the pattern of characters you are willing to accept for it, so: (r'^order_closeouts/(?P<foo>\w{4})/(?P<prod>w+)/$', 'onhand.views.order_closeouts', ), But that says you are willing to accept one or more 'w' characters for prod. I expect you meant the character class \w: (r'^order_closeouts/(?P<foo>\w{4})/(?P<prod>\w+)/$', 'onhand.views.order_closeouts', ), which would accept one or more alphanumerics or the underscore, that is the set [a-zA-Z0-9_]. But that won't quite work for the URL you have specified, as it includes spaces (url-encoded as %20). If you want to allow spaces as well you'll need to change the pattern to allow that: (r'^order_closeouts/(?P<foo>\w{4})/(?P<prod>[ \w]+)/$', 'onhand.views.order_closeouts', ), Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---