Error redirecting after login
<p>I am trying to redirect users to a create-profile form after signup.Since I don't know how to use dynamic url for LOGIN_REDIRECT_URL.I tried this little trick of linking it to a static view then finally to a dynamic view using <code>redirect</code>.It gives the error <code>Reverse for 'add_profile' with arguments '()' and keyword arguments '{'username': u'badguy'}' not found. 0 pattern(s) tried: []</code> (with 'badguy' truly the username of the just signed-up user').From the error,it is clearly passing the username to the view.My codes are:</p>

<pre><code>settings.py
LOGIN_REDIRECT_URL = '/prof-change/gdyu734648dgey83y37gyyeyu8g/'

urls.py
 url(r'^prof-change/gdyu734648dgey83y37gyyeyu8g/',views.login_redir,name='login_redir'),
 url(r'^create-profile/(?P&lt;username&gt;\w+)/$',views.add_profile,name='create-profile'),

views.py
def login_redir(request):
    user=get_object_or_404(User,username=request.user.username)
    username=user.username
    return redirect('add_profile',username=username)

def add_profile(request,username):
    userman=User.objects.get(username=username)
    ........
    ........
</code></pre>

<p>When you reverse urls (including when you use a url name with the <code>redirect</code> shortcut), you should use the name of the <em>url pattern</em>,  not the view. The url pattern has <code>name='create-profile'</code>, so use that. </p>

<pre><code>redirect('create-profile', username=username)
</code></pre>

python django django-views