Match alternate url - django urls regex
Try r'^(?P<status>in|out)/$'
You need to remove \w+
that matches one or more alphanumeric or underscore characters. The regex suggested in bstpierre's answer '^(?P<status>\w+(in|out))/$'
will match helloin
, good_byeout
etc.
When I originally wrote this answer in 2009, Django was unable to reverse the regexes that used the pipe character |
. However, this restriction has since been lifted. The limitation is mentioned in the 1.4 docs but not the 1.5 docs , so I am assuming it was changed in Django 1.5.
source to share