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
This commit is contained in:
Malcolm Tredinnick 2008-04-27 11:44:11 +00:00
parent 9c52d56f6f
commit d0c49e7b77
1 changed files with 1 additions and 1 deletions

View File

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