Ticket #7249: 1.diff
File 1.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/views/decorators.py
85 85 if '@' in username: 86 86 # Mistakenly entered e-mail address instead of username? Look it up. 87 87 try: 88 users = list(User.objects.filter(email=username)) 89 if len(users) == 1: 90 user = users[0] 91 else: 92 # Either we cannot find the user, or if more than 1 93 # we cannot guess which user is the correct one. 94 raise User.DoesNotExist() 95 except User.DoesNotExist: 88 user = User.objects.get(email=username) 89 except (User.DoesNotExist, AssertionError): 96 90 message = _("Usernames cannot contain the '@' character.") 97 91 else: 98 92 message = _("Your e-mail address is not your username. Try '%s' instead.") % user.username