Opened 10 years ago

Closed 9 years ago

#516 closed defect (wontfix)

Discrepancy in usage naming of login template file

Reported by: freakboy@… Owned by: adrian
Component: Template system Version:
Severity: trivial Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The admin site uses a template directory of <django>/conf/admin_templates, and uses the login.html template file to present a login screen to the user. This name is determined by AdminUserRequired.get_login_template_name(). When TEMPLATE_DIRS for the admin site is pointed to the default templates at <django>/conf/admin_templates, the admin view correctly displays (since this directory contains login.html).

However, the <django>/views/auth/login.py view, which is used by the @login_required decorator, references the template 'registration/login'. As a result, if you write a user site that utilizes @login_required, it is not possible to use the same setting for TEMPLATE_DIRS as is used by the admin view.

There are two possible (mutually exclusive) fixes:
1) modify AdminUserRequired.get_login_template_name() to return 'registration/login', rather than 'login'
2) modify views/auth/login.py to reference 'login', rather than 'registration/login'

I'm not certain which of the two is 'correct', and Django applications work fine without this change (as long as you provide your own login template) but having a default setting for login_required which is incompatible with the default directory layout seems broken.

Change History (2)

comment:1 Changed 10 years ago by freakboy@…

  • Component changed from Generic views to Template system
  • Owner changed from jacob to adrian

comment:2 Changed 9 years ago by adrian

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

The admin is a separate app than the registration app, so they get separate templates.

Note: See TracTickets for help on using tickets.
Back to Top