The docs state that "An included URLconf receives any captured parameters from parent URLconfs". And that does work as expected, when the child URLconf makes immediate use of the parameter -- that is, the child URLconf is a terminal node and doesn't include any further child URLconfs.
In my particular use-case, I find myself needing to use two levels of URLconf includes, and when I do this, the captured parameter seems to get lost along the way.
Examples:
a) In this scenario, "my_view" gets app1_pk passed in kwargs (expected behavior).
root urls.py:
…
url(r'^app1/(?P<app1_pk>\d+)/app2/', include('app2.urls')),
…
…
url(r'^my_view/$', 'app2.views.my_view'),
…
b) In this scenario (my use-case), "my_view" does not get app1_pk passed in kwargs (but I do not expect this to be the correct behavior).
root urls.py:
…
url(r'^app1/', include('app1.urls')),
…
…
url(r'^(?P<app1_pk>\d+)/app2/', include('app2.urls')),
…
…
url(r'^my_view/$', 'app2.views.my_view'),
…
Is this expected behavior? Any thoughts?
Thanks in advance,
Jason