Following is from urls.py:
url(r'^\?view=(?P<vtype>instructor|course|room)$', 'index', name='index'),
i can verify that it works by simply calling django.core.urlresolvers.reverse in shell :
In [6]: reverse('index', args=["course"])
Out[6]: '/?view=course'
but when i try to access http://localhost:8000/?view=course i get 404.
What am i doing wrong here?
Thanks
Edit:
url('^search/\?user=(?P<userid>\d+)&type=topic', 'search_forum', name='my_topics'),
this is from a former project which works as expected. sigh...
Your regex matches from the beginning (^) but I don't see anything to match the leading '/'. Could this be it?
Query string is not part of the URL. If you want to do it this way, you have to use
url(r'^$', 'index', name='index')
and then look it up in request.GET dictionary in the view.The usual way, however, is to use
url(r'(?P<vtype>instructor|course|room)/$', 'index', name='index')
. The querystring approach is the usual workaround for not being able to direct requests according to the non-querystring URL part. Django does not have that limitation.