#3407: [patch] added 'default_next' parameter to django.core.auth.views.login
-------------------------------+--------------------------------------------
Reporter:  [EMAIL PROTECTED]  |       Owner:  jacob          
  Status:  new                 |   Component:  Uncategorized  
 Version:  SVN                 |    Keywords:  auth login next
   Stage:  Unreviewed          |   Has_patch:  1              
-------------------------------+--------------------------------------------
 just as in #377, having default next hardcoded doesn't feel good,
 pythonic, etc., but a simple hack has come to remedy that:
 
 {{{
 Index: views.py
 ===================================================================
 --- views.py    (wersja 4454)
 +++ views.py    (kopia robocza)
 @@ -8,7 +8,7 @@
  from django.contrib.auth.decorators import login_required
  from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
 
 -def login(request, template_name='registration/login.html'):
 +def login(request, template_name='registration/login.html',
 default_next='/accounts/profile/'):
      "Displays the login form and handles the login action."
      manipulator = AuthenticationForm(request)
      redirect_to = request.REQUEST.get(REDIRECT_FIELD_NAME, '')
 @@ -17,7 +17,7 @@
          if not errors:
              # Light security check -- make sure redirect_to isn't
 garbage.
              if not redirect_to or '://' in redirect_to or ' ' in
 redirect_to:
 -                redirect_to = '/accounts/profile/'
 +                redirect_to = default_next
              from django.contrib.auth import login
              login(request, manipulator.get_user())
              request.session.delete_test_cookie()
 }}}
 
 I'm aware that it's not a generic view, but it doesn't make sense for so
 much to be hardcoded just for what seems purely naming reasons.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3407>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to