From ffd535e4136dc54f084b6ac467e81444696e1c8a Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sun, 16 Sep 2012 20:31:28 +0800 Subject: [PATCH] Corrected attribute access on for get_by_natural_key --- django/contrib/auth/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 7f5f5f6801..748fb603cf 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -165,7 +165,7 @@ class BaseUserManager(models.Manager): return get_random_string(length, allowed_chars) def get_by_natural_key(self, username): - return self.get(**{getattr(self, 'USERNAME_FIELD', 'username'): username}) + return self.get(**{getattr(self.model, 'USERNAME_FIELD', 'username'): username}) class UserManager(BaseUserManager):