After a user successfully registers an account (creates a username and password) the webpage returns a blank registration form.
I would like to redirect to the 'landingpage' url after successful registration.
Here is the html form:
<form method="post" action="{% url 'register' %}">
{% csrf_token %}
<table>{{ form.as_table }}</table>
<input type="submit" value="register" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
and urls.py:
from django.views.generic.edit import CreateView
from django.contrib.auth.forms import UserCreationForm
urlpatterns = [
url('^accounts/register/', CreateView.as_view(
template_name='registration/register.html',
form_class=UserCreationForm,
success_url='landingpage'
), name='register'),
url('^accounts/', include('django.contrib.auth.urls')),
url(r'^$', views.landingpage, name='landingpage'), ]
Should the success_url='landingpage' redirect to the landingpage url?
How do I redirect to the landingpage url after a successful registration?