https://bitbucket.org/ubernostrum/django-registration with minor modifications