Previously I’ve been using some older version of django-registration which seems to be deprecated now. Because my server does not allow me to install python plugins I need to use ‘registration’ as separate django application. Now my question is what do I need to modify in order to get registation running as django-app ? Can I just copy ‘registration’ to my django project catalog, add it in settings and it should work ? Previously there was no such thing as ‘backend’ defined, now backend init file with function get_backend, that takes ‘path’ as argument. I guess this path is sent via url right ?
url(r'^activate/(?P<activation_key>\w+)/$',
activate,
{'backend': 'registration.backends.default.DefaultBackend'},
name='registration_activate'),
Inside this catalog there’s also init file with DefaultBackend class, with classes activate and register.
http://paste.pocoo.org/show/225790/
They both use signals. Do I need to bother with those signals in any way ? (I still don’t quite get what they’re used for).
Last thing. Previously after registration it was redirecting te either given success_url or set template in this way :
return HttpResponseRedirect(success_url or reverse('registration_complete'))
Now code responsible for this looks :
if success_url is None:
to, args, kwargs = backend.post_registration_redirect(request, new_user)
return redirect(to, *args, **kwargs)
else:
return redirect(success_url)
and the post_registration_redirect :
def post_registration_redirect(self, request, user):
"""
Return the name of the URL to redirect to after successful
user registration.
"""
return ('registration_complete', (), {})
So why was this changed in this way if it still simply redirect to ‘registration_complete’ ? The args and kwargs are empty so why bother ?
The situation is much simpler than you’re making it out to be. Django applications (like registration) are just normal Python packages and can be imported as such. What that means is that registration can live anywhere that’s in your python path already. Oftentimes the simplest place for that is in your root project directory.
The backend argument there just takes a python import path. The argument was added so that people could extend Django-Registration to use custom backends if they so desire.
If you put the registration directory on your python path the existing string should work just fine.