mirror of https://github.com/django/django.git
Fixed #7342: Ignore any Meta options starting with '_', thus making it OK for Meta to be a newstyle class. Thanks, Gulopine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7585 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8a7bbc3c34
commit
50de13343b
|
@ -56,8 +56,12 @@ class Options(object):
|
||||||
# Next, apply any overridden values from 'class Meta'.
|
# Next, apply any overridden values from 'class Meta'.
|
||||||
if self.meta:
|
if self.meta:
|
||||||
meta_attrs = self.meta.__dict__.copy()
|
meta_attrs = self.meta.__dict__.copy()
|
||||||
del meta_attrs['__module__']
|
for name in self.meta.__dict__:
|
||||||
del meta_attrs['__doc__']
|
# Ignore any private attributes that Django doesn't care about.
|
||||||
|
# NOTE: We can't modify a dictionary's contents while looping
|
||||||
|
# over it, so we loop over the *original* dictionary instead.
|
||||||
|
if name.startswith('_'):
|
||||||
|
del meta_attrs[name]
|
||||||
for attr_name in DEFAULT_NAMES:
|
for attr_name in DEFAULT_NAMES:
|
||||||
if attr_name in meta_attrs:
|
if attr_name in meta_attrs:
|
||||||
setattr(self, attr_name, meta_attrs.pop(attr_name))
|
setattr(self, attr_name, meta_attrs.pop(attr_name))
|
||||||
|
|
Loading…
Reference in New Issue