title: How to redirect url pattern with variables from urls.py in Django?
body: <p>I'd like to redirect url pattern <b>with variables</b> from <code>urls.py</code>.</p>
  
  <p>I refer  <a href="https://stackoverflow.com/questions/15706489/redirect-to-named-url-pattern-directly-from-urls-py-in-django">other stackoverflow solution</a>, but I don't know when url having a variable like following code.</p>
  
  <pre><code>from django.conf.urls import patterns, url
  from django.views.generic import RedirectView
  
  
  urlpatterns = patterns(
      url(
          r'^permalink/(?P&lt;id&gt;\d+)/foo/$',
          RedirectView.as_view(url='/permalink/(?P&lt;id&gt;\d+)/')
      ),
  )
  </code></pre>
  
  <p>With this code, django will redirect <code>/permalink/1/foo/</code> to <code>/permalink/(?P&lt;id&gt;\d+)/</code>, not the <code>/permalink/1/</code>.</p>
  
  <p>Is there any solution <b>without using <code>views.py</code></b>?</p>
  
  <p>Of course I know solution using controller, but I wonder is there any simpler solution with using url pattern.</p>