django.contrib.auth.login doesn't just take any user, it needs one that's been modified by authenticate
Looking at http://www.djangoproject.com/documentation/authentication/, you'd think you could just pass in a request and a User. But you can't. The code for login needs the side effect caused by calling authenticate, which is to add the backend to the user object.
This is very frustrating when writing code where you'd like to log a user in automatically. At the very least, the documentation needs to be changed to reflect it.
Change History
(7)
Triage Stage: |
Unreviewed → Accepted
|
Component: |
Contrib apps → Documentation
|
Owner: |
changed from nobody to David A Krauth
|
Status: |
new → assigned
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Yes, this looks like it should be mentioned somewhere in the authentication docs and probably in
login()
's docstring also.