Question

I have a Django application running an older version Django-Registration. In that application, I'm overriding the normal registration form with a custom one that I have created like so:

from myApp.forms import extendedRegistrationForm

# using my registration form to override the default
url (
    r'^accounts/register/$', 
    'registration.views.register',
    {
        'form_class': extendedRegistrationForm,
        'backend': 'registration.backends.default.DefaultBackend',
    }
),    

It works fine. However, I am now migrating to the current version of Django-registration which I'm told does not have a view named registration.views.register. Instead it has a class-based view RegistrationView. So I get the following error:

Could not import registration.views.register. View does not exist in module registration.views.

Can someone show me how to adapt my code above to work with RegistrationView?

Was it helpful?

Solution

Try

from registration.views import RegistrationView

register = RegistrationView.as_view()

url (
    r'^accounts/register/$', 
    register,
    {
        'form_class': extendedRegistrationForm,
        'backend': 'registration.backends.default.DefaultBackend',
    }
),  
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top