I'm using django-registration (see: https://bitbucket.org/ubernostrum/django-registration ) on one of my projects. The standard setup for the django-registration is to add a the code below in the urls.py file
(r'^accounts/', include('registration.urls'))
and also customize the templates in a folder called registration.
The code above is creating links to the registration, login and password recovery which is fine. But in my project there are some other functions I usually add to my views so if I just add the include('registration.urls') it appears that I have no way of customizing the views containing those django-registration forms.
Is there a way to call the forms used by the django-registrationin a view so I can add a few more things on those views ?
The registration form is provided by the registration backend. Check out
registration.backends.default.DefaultBackend.There's a method
get_form_class(request)that returns theregistration.forms.RegistrationFormclass. All you have to do is create a new backend, inherit fromDefaultBackendand override theget_form_class()method to return a new form class.You can pretty much do anything by providing a custom backend, except changing the base behavior of the registration app. If you need to radically customize the views in a manner that providing a custm backend doesn't make the cut, then just create a
authnorusersapp and import any bits from django-registration you find useful. You can, say, keep the default models and managers within theregistrationapp namespace, but hook up a custom backend to your own internals in a new app.