Commits

Anonymous committed 781fe02

Added DEFAULT_POST_REGISTRATION_URL as an easier way to change where
to get redirected to after a registration.

  • Participants
  • Parent commits a56f960

Comments (0)

Files changed (2)

docs/simple-backend.rst

     ``True`` will be assumed if this setting is not supplied.
 
 Upon successful registration, the default redirect is to the URL
-specified by the ``get_absolute_url()`` method of the newly-created
+specified by the DEFAULT_POST_REGISTRATION_URL in settings.py.
+If that setting is absent, it will redirect to the 
+``get_absolute_url()`` method of the newly-created
 ``User`` object; by default, this will be ``/users/<username>/``,
 although it can be overridden in either of two ways:
 

registration/backends/simple/__init__.py

 
     def post_registration_redirect(self, request, user):
         """
-        After registration, redirect to the user's account page.
+        After registration, redirect to the appropriate page.
+        Uses DEFAULT_POST_REGISTRATION_URL from settings if present.
+        Else goes to user's account page, as defined in User class.
         
         """
+
+        if getattr(settings, 'DEFAULT_POST_REGISTRATION_URL', None):
+            return (getattr(settings, 'DEFAULT_POST_REGISTRATION_URL'), (), {}
         return (user.get_absolute_url(), (), {})
 
+
     def post_activation_redirect(self, request, user):
         raise NotImplementedError