From d0c49e7b779b37569f564abb1675cb764ab65c04 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 27 Apr 2008 11:44:11 +0000 Subject: [PATCH] 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 --- django/db/models/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))