Django URL regex question
- by shawnjan
Hey all!
I had a quick question about Django URL configuration, and I guess REGEX as well. I have a small configuration application that takes in environments and artifacts in the following way:
url(r'^env/(?P<env>\w+)/artifact/(?P<artifact>\w+)/$', 'config.views.ipview', name="bothlist"),
Now, this works fine, but what I would like to do is have it be able to have additional parameters that are optional, such as a verbose mode or no formating mode. I know how to do this just fine in the views, but I can't wrap my head around the regex.
the call would be something like
GET /env/<env>/artifact/<artifact>/<opt:verbose>/<opt:noformat>
Any help would be appreciated, thanks!
-Shawn