Browse files

Fixed #7342: Ignore any Meta options starting with '_', thus making i…

…t OK for Meta to be a newstyle class. Thanks, Gulopine.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 8a7bbc3 commit 50de13343b9daa9da30b9111dab2e15d8f24465d @jacobian jacobian committed Jun 7, 2008
Showing with 6 additions and 2 deletions.
  1. +6 −2 django/db/models/
@@ -56,8 +56,12 @@ def contribute_to_class(self, cls, name):
# Next, apply any overridden values from 'class Meta'.
if self.meta:
meta_attrs = self.meta.__dict__.copy()
- del meta_attrs['__module__']
- del meta_attrs['__doc__']
+ for name in self.meta.__dict__:
+ # 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:
if attr_name in meta_attrs:
setattr(self, attr_name, meta_attrs.pop(attr_name))

0 comments on commit 50de133

Please sign in to comment.