i'm facing some strange behavior in Django 1.8.3. (Note: I started the project with 1.7.4) I want to reuse a view in case it gets an get-request, so i defined following urls in the urls.py located at the same place where my settings.py is.
(Note: this is the short version)
urlpatterns = patterns('',
url(r'^licenses/$', views.licenses),
url(r'^licenses/(?P<pool>.*)/$', views.licenses, name='pool'),
)
in my views.py i defined following view:
def licenses(request, pool=None):
print request, request.GET
print pool
the template (base.html) calling the view:
<li><a href="/licenses/">Licenses</a>
<ul>
{% for pool in LICENSE_MENU %}
<li class="dir"><a href="/licenses/{{ pool }}">{{ pool }}</a></li>
{% endfor %}
</ul>
</li>
LICENSE_MENU is a list of licenses passed by a context_processor to the base.html
Everything works almost fine. If i click a license i get redirected to licenses() but the license i clicked doesn't show up in the request. The output of my shell when i run the testserver and click on the link is following:
[06/Oct/2015 12:16:03]"GET / HTTP/1.1" 200 129165
<WSGIRequest: GET '/licenses/'> <QueryDict: {}>
[06/Oct/2015 12:16:06]"GET /licenses/ HTTP/1.1" 200 128597
<WSGIRequest: GET '/licenses/ansys/'> <QueryDict: {}>
ansys
[06/Oct/2015 12:16:11]"GET /licenses/ansys/ HTTP/1.1" 200 128851
Why does my view print pool although it is not in the request querydict? What am i missing? Thanks in advance.