I am currently going through the tango with django tutorial and trying to implement django registration with redirect after it was successful.
I followed both the tutorial and what I found in a linkanother question.
When I register, I get
TypeError at /accounts/register/
get_success_url() missing 1 required positional argument: 'user'
urls.py
from django.conf.urls import include, url, patterns
from django.contrib import admin
from registration.backends.simple.views import RegistrationView
class MyRegistrationView(RegistrationView):
def get_success_url(self, request, user):
return '/student/'
urlpatterns = [
url(r'^student/', include('student.urls')),
url(r'^admin/', admin.site.urls),
# Add in this url pattern to override the default pattern in accounts.
url(r'^accounts/register/$', MyRegistrationView.as_view(), name='registration_register'),
url(r'^accounts/', include('registration.backends.simple.urls')),
url(r'', include('registration.auth_urls')),
]
Anyone an idea what I might be doing wrong?
Thanks!
Things have changed from then, now you supply 'user' as first positional argument. And there is no request
argument for get_success_url
method. Your code should look like this:
class MyRegistrationView(RegistrationView):
def get_success_url(self, user):
return '/student/'
See: Old RegistrationView and new RegistrationView at github.