Code

Opened 4 years ago

Closed 4 years ago

#14510 closed (wontfix)

Django admin doesn't consider settings.LOGIN_REDIRECT_URL

Reported by: googol Owned by: nobody
Component: Contrib apps Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The Django Admin /contrib/admin/sites.py doesn't consider redirect_to nor settings.LOGIN_REDIRECT_URL

def login(self, request):

return http.HttpResponseRedirect(request.get_full_path())

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by googol

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

ADMIN_ LOGIN_REDIRECT_URL would be a solution IMHO. We already have ADMIN_MEDIA_PREFIX for instance

comment:2 Changed 4 years ago by gabrielhurley

  • Resolution set to wontfix
  • Status changed from new to closed

This behavior is intentional (to the best of my knowledge and understanding). LOGIN_REDIRECT_URL is meant for redirecting users to a landing page or other such URL in the public-facing portion of your website. It would be extremely frustrating to log in to the Django admin app and have it redirect me to a page elsewhere on the site.

If your use case involves customizing the admin in some way such that you want users to land on a specific admin page after they log in (or to have it be customizable based on some parameter), my inclination is that the best thing to do is to subclass AdminSite and override the login method.

If you feel there is a broad use case for having the admin login function allow redirecting to arbitrary locations, I would suggest starting a thread on the Django Developers mailing list to gain support for it.

Thanks for the report!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.