urlpatterns = [url('^permalink/(?P<id>\\d+)/foo/$', RedirectView.as_view(
    pattern_name='target_view'), name='original_view'), url(
    '^permalink/(?P<id>\\d+)/$', views.permalink, name='target_view')]
How to redirect url pattern with variables from urls.py in Django?