Leo  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
  • Branches default

Comments (0)

Files changed (2)

File 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
+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:

File registration/backends/simple/

     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