diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-27 11:44:11 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-27 11:44:11 +0000 |
| commit | d0c49e7b779b37569f564abb1675cb764ab65c04 (patch) | |
| tree | b31eb9d29a35e0e1ae04ca0af2d0f0ace262039a | |
| parent | 9c52d56f6f8a9cdafb231adf9f4110473099c9b5 (diff) | |
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
| -rw-r--r-- | django/db/models/options.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/options.py b/django/db/models/options.py index 8fcaed485e..5802ead081 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -248,7 +248,7 @@ class Options(object): 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)) |
