Permalink
Browse files

When retrieving a field by name, handle a missed case when the cache …

…cannot be

initialised yet.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7478 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 9c52d56 commit d0c49e7b779b37569f564abb1675cb764ab65c04 @malcolmt malcolmt committed Apr 27, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 django/db/models/options.py
@@ -248,7 +248,7 @@ def get_field_by_name(self, name):
return self._name_map[name]
except AttributeError:
cache = self.init_name_map()
- return self._name_map[name]
+ return cache[name]
except KeyError:
raise FieldDoesNotExist('%s has no field named %r'
% (self.object_name, name))

0 comments on commit d0c49e7

Please sign in to comment.