def login_using_email(request, email):
'''DONT EVER USE this method for normal purposes. This is only there, for debugging specific problems related to users'''
from django.contrib.auth import get_backends
backend = get_backends()[0]
from django.contrib.auth.models import User
user = User.objects.get(email=email)
user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)
from django.contrib.auth import login as django_login
django_login(request, user)
#set_any_extra_session_variables(request)
Comments
Check out an 'su' view: http://copiousfreetime.blogspot.com/2006/12/django-su.html
It does the same thing as this snippet but with wrapping and explanations.
#
ВИП-сваха для брака с богачом
#
прокат, аренда аттракционов Киев, большой выбор
#