Commits

dfoerster committed 6e393f4

+ Add support for passing a backend instance to the views

Comments (0)

Files changed (1)

registration/views.py

 from registration.backends import get_backend
 
 
-def activate(request, backend,
+def activate(request, backend_instance=None, backend=None,
              template_name='registration/activate.html',
              success_url=None, extra_context=None, **kwargs):
     """
     registration/activate.html or ``template_name`` keyword argument.
     
     """
-    backend = get_backend(backend)
+    if backend_instance:
+        backend = backend_instance
+    else:
+        backend = get_backend(backend)
     account = backend.activate(request, **kwargs)
 
     if account:
                               context_instance=context)
 
 
-def register(request, backend, success_url=None, form_class=None,
+def register(request, backend_instance=None, backend=None, success_url=None, form_class=None,
              disallowed_url='registration_disallowed',
              template_name='registration/registration_form.html',
              extra_context=None):
     argument.
     
     """
-    backend = get_backend(backend)
+    if backend_instance:
+        backend = backend_instance
+    else:
+        backend = get_backend(backend)
+
     if not backend.registration_allowed(request):
         return redirect(disallowed_url)
     if form_class is None: