django url pattern for %20

John picture John · Sep 9, 2010 · Viewed 13.4k times · Source

In Django what is the url pattern I need to use to handle urlencode characters such as %20

I am using (?P<name>[\w]+) but this only handles alphanumeric characters so % is causing an error

Answer

Manoj Govindan picture Manoj Govindan · Sep 9, 2010

I was able to make it work using the configuration given below. Check if it will suit your needs.

(?P<name>[\w|\W]+)