Reputation: 4521
I am using Django==1.8
and django-registration-redux
for registration. When I try to login with my superuser and password, it is automatically redirected to http://127.0.0.1:8000/accounts/profile/
. Is there any way I can control where my url
will redirect once the user logged in? You can see the below image:
Suppose I want to redirect to /home/
once the user logged in, then how will i do that? Please help!!
Login.html
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Log in' %}" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<p>{% trans "Forgot password" %}? <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>!</p>
<p>{% trans "Not member" %}? <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>!</p>
{% endblock %}
Upvotes: 0
Views: 323
Reputation: 10315
Yes you can customize this by putting LOGIN_REDIRECT_URL
in settings.py file.
So in this case you can do it like...
LOGIN_REDIRECT_URL = /home/
Upvotes: 3