views:

38

answers:

1

I want django-registration (version 0.8) to use my custom form rather than the default one. However, I want to continue to use the default django-registration view. What should the rest of the line below look like to achieve this?

(r'^accounts/register'...),

I've tried this below but get a syntax error:

(r'^accounts/register/$', 
         'registration.views.register', 
         {'form_class': 'MyRegistrationForm'}, name='registration_register'),

And when I try this one below I get register() takes at least 2 non-keyword arguments (1 given)

(r'^accounts/register/$',      
    'registration.views.register',             
    {'form_class':'MyRegistrationForm'}),
+1  A: 

Looking at the views.register function,

def register(request, backend, success_url=None, form_class=None,
             disallowed_url='registration_disallowed',
             template_name='registration/registration_form.html',
             extra_context=None):

you can see that backend is a required argument. Try the following:

url(r'^accounts/register/$', 
         'registration.views.register', 
         {'form_class': MyRegistrationForm,
          'backend':'registration.backends.default.DefaultBackend'},
         name='registration_register'),

note that you need to use url(r'^...) if you wish to name your url.

Alasdair
Just needed to change to registration.backends.default.DefaultBackend'and it worked. Many thanks!
swisstony
Thanks for the feedback, I updated my answer.
Alasdair