Can someone please explain how you can write a url pattern and view that allows optional parameters? I've done this successfully, but I always break the url template tag.
Here's what I have currently:
Pattern
(r'^so/(?P<required>\d+)/?(?P<optional>(.*))/?$', 'myapp.so')
View
def so(request, required, optional):
If I use the url template tag in this example providing both arguments, it works just fine; however, if I omit the optional argument, I get a reversing error.
How can I accomplish this?
Thanks, Pete