Corrected attribute access on for get_by_natural_key

This commit is contained in:
Russell Keith-Magee 2012-09-16 20:31:28 +08:00
parent 913e1ac84c
commit ffd535e413
1 changed files with 1 additions and 1 deletions

View File

@ -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):