Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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: http://code.djangoproject.com/svn/django/trunk@7585 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 50de13343b9daa9da30b9111dab2e15d8f24465d 1 parent 8a7bbc3
Jacob Kaplan-Moss authored June 07, 2008

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  django/db/models/options.py
8  django/db/models/options.py
@@ -56,8 +56,12 @@ def contribute_to_class(self, cls, name):
56 56
         # Next, apply any overridden values from 'class Meta'.
57 57
         if self.meta:
58 58
             meta_attrs = self.meta.__dict__.copy()
59  
-            del meta_attrs['__module__']
60  
-            del meta_attrs['__doc__']
  59
+            for name in self.meta.__dict__:
  60
+                # Ignore any private attributes that Django doesn't care about.
  61
+                # NOTE: We can't modify a dictionary's contents while looping
  62
+                # over it, so we loop over the *original* dictionary instead.
  63
+                if name.startswith('_'):
  64
+                    del meta_attrs[name]
61 65
             for attr_name in DEFAULT_NAMES:
62 66
                 if attr_name in meta_attrs:
63 67
                     setattr(self, attr_name, meta_attrs.pop(attr_name))

0 notes on commit 50de133

Please sign in to comment.
Something went wrong with that request. Please try again.