Opened 19 years ago

Closed 19 years ago

#516 closed defect (wontfix)

Discrepancy in usage naming of login template file

Reported by: freakboy@… Owned by: Adrian Holovaty
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: no UI/UX: no

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 by freakboy@…, 19 years ago

Component: Generic viewsTemplate system
Owner: changed from Jacob to Adrian Holovaty

comment:2 by Adrian Holovaty, 19 years ago

Resolution: wontfix
Status: newclosed

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