Discrepancy in usage naming of login template file
|Reported by:||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.