title: Django: Keeping captured parameters after redirections
body: <p>I'm having some trouble with the interaction between URLs and views. In my project, I have redirections and double redirections, and they are working fine, but when I try to recover the parameters captured by the regular expression the target view complains that it's receiving no parameters. This is my implementation:</p>
  
  <p>project/urls.py:</p>
  
  <pre><code>lang_re = r'(ca|en|es|fr|ge)'
  
  urlpatterns = patterns('',
      url(r'^$', RedirectView.as_view(url='/en/home/')),
      url(r'^'+lang_re+'/home/', include('components.home.urls', namespace='components.home')),
      ...
  )
  </code></pre>
  
  <p>components/home/urls.py:</p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^$', RedirectView.as_view(url='cover')),
      url(r'^cover$', views.cover, name='home_cover'),
      ...
  )
  </code></pre>
  
  <p>components/home/views.py</p>
  
  <pre><code>def cover(request, lang_code):
      ...
  </code></pre>
  
  <p>What happens here, for instance, when one goes to the root, is that one gets redirected to "/en/home". This matches the second regular expression (and it's supposed to capture the "en" part as a parameter), after which the user is redirected again to "/en/home/cover" through a relative redirection. This last URL finally finds a permanent view, "components.home.views.cover", and runs its function. The problem is that after the redirection the captured parameter ("en") seems to be lost, and Django gives me the following error message:</p>
  
  <pre><code>Request Method: GET
  Request URL: http://localhost:8000/en/home/cover
  Django Version: 1.5.2
  Exception Type: TypeError
  Exception Value: cover() missing 1 required positional argument: 'lang_code'
  </code></pre>
  
  <p>Any clue on how could I combine redirections and captured parameters?</p>