Django request parameter with space

I have a url that accepts request parameters that may have spaces in it. I know this looks pretty simple, but my regex doesn't work for me.

Here is my url pattern definition:

url( r'^item_info_details_view/(?P<itemno>[\w \/&-]+)/$', 'purchasing.views.item_info_details_view'), 

An element may be a phrase, such as FAX MODEM , that contains a space.

However, when I pass it such a parameter, the URL of my browser

 http://localhost/item_info_details_view/FAX%20MODEM/ 

And displays this information for debugging:

 Using the URLconf defined in urls, Django tried these URL patterns, in this order: ^$ The current URL, item_info/FAX MODEM/, didn't match any of these. 
+5
source share
1 answer

The problem does not seem to be in space, but that you have "item_info_details_view" in urlconf, but "item_info" in the actual URL.

(As written by @ daniel-roseman)

0
source

All Articles