It's easy, just save the url and write your own backend overriding 2 methods.
accounts/models.py
class UserNext(models.Model):
user = models.OneToOneField(User)
url = models.CharField(max_length=255, blank=True, null=True)
accounts/nextbackend.py:
from registration.backends.default import DefaultBackend
from django.core.urlresolvers import resolve
from accounts.models import UserNext
class NextBackend(DefaultBackend):
def register(self, request, **kwargs):
username, email, password = kwargs['username'], kwargs['email'], kwargs['password1']
if Site._meta.installed:
site = Site.objects.get_current()
else:
site = RequestSite(request)
new_user = RegistrationProfile.objects.create_inactive_user(username, email,
password, site)
signals.user_registered.send(sender=self.__class__,
user=new_user,
request=request)
next, created = UserNext.objects.get_or_create(user=new_user)
next.url = request.GET.get('next',None) # or POST, don't know how you want to pass it
next.save()
return new_user
def post_activation_redirect(self, request, user):
next = UserNext.objects.get(user=user)
view, args, kwargs = resolve(next.url)
return (view, args, kwargs)
user this^ backend as your registration backend in accounts/views.py:
def custom_register(request):
return register(request, backend='accounts.nextbackend.NextBackend',)
urls.py:
url(r'^accounts/register/$', 'accounts.views.custom_register', name='registration_register'),
Should work, didn't test it, written on the fly. Obviously will need adding some imports.