How to redirect a Django template and use the 'Next' variable?
<p>I am using Django's built in login view as can be seen in the following snippets:</p>

<p><strong>urls.py</strong></p>

<pre><code>    url(r'^login$',login,{'template_name': 'login.html'},name="login"),
</code></pre>

<p><strong>template.html</strong></p>

<pre><code>&lt;form method="post" action="{% url 'login' %}"&gt;
{% csrf_token %}
&lt;table&gt;
&lt;tr&gt;
    &lt;td&gt;{{ form.username.label_tag }}&lt;/td&gt;
    &lt;td&gt;{{ form.username }}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td&gt;{{ form.password.label_tag }}&lt;/td&gt;
    &lt;td&gt;{{ form.password }}&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;input type="submit" value="login" /&gt;
&lt;input type="hidden" name="next" value="{{ next }}" /&gt;
&lt;/form&gt;
</code></pre>

<p>How can I use the next variable to redirect to a URL different than the default <em>/accounts/profile/</em> that django redirects to? I know of people referring to the settings.py file but I am wondering how I can utilize the next variable to do this?</p>

<p>(I'm not really sure of how the next variable works even after referring to documentation, an explanation of this would be much appreciated)</p>