10π
β
Try r'^(?P<status>in|out)/$'
You need to remove \w+
, which matches one or more alphanumeric characters or underscores. The regular expression suggested in bstpierreβs answer, '^(?P<status>\w+(in|out))/$'
will match helloin
, good_byeout
and so on.
Note that if you use the vertical bar (pipe) character |
in your url patterns, Django cannot reverse the regular expression. If you need to use the url tag in your templates, you would need to write two url patterns, one for in
and one for out
.
π€Alasdair
1π
You want (in|out), the [] you are using indicate a character class containing the characters βiβ, βnβ, β|β, βoβ, βuβ, βtβ.
π€bstpierre
- [Django]-ManyToMany in Django admin: select none
- [Django]-Django messages framework with built-in Jinja2 backend
Source:stackexchange.com