1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

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

View File

@ -248,7 +248,7 @@ class Options(object):
return self._name_map[name] return self._name_map[name]
except AttributeError: except AttributeError:
cache = self.init_name_map() cache = self.init_name_map()
return self._name_map[name] return cache[name]
except KeyError: except KeyError:
raise FieldDoesNotExist('%s has no field named %r' raise FieldDoesNotExist('%s has no field named %r'
% (self.object_name, name)) % (self.object_name, name))