diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-02-26 09:06:23 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-02-26 09:06:23 +0000 |
| commit | c27ba0b2097267796bc97daea81ee62dd10554ff (patch) | |
| tree | ddaf14740f1061f71a30e68f95fb483825cbff3b | |
| parent | 83da190e4053e87ebdeb6b3507b57ec3e2ee0059 (diff) | |
Fixed #2363 -- Fixed subclass checking in ModelBase to allow for mixin
superclasses. Thanks phil.h.smith@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/db/models/base.py | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -149,6 +149,7 @@ answer newbie questions, and generally made Django that much better: pgross@thoughtworks.com phaedo <http://phaedo.cx/> phil@produxion.net + phil.h.smith@gmail.com Gustavo Picon Luke Plant <http://lukeplant.me.uk/> plisk diff --git a/django/db/models/base.py b/django/db/models/base.py index 5436d80a0e..ff99fd8b46 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -22,8 +22,8 @@ class ModelBase(type): "Metaclass for all models" def __new__(cls, name, bases, attrs): # If this isn't a subclass of Model, don't do anything special. - if not bases or bases == (object,): - return type.__new__(cls, name, bases, attrs) + if name == 'Model' or not filter(lambda b: issubclass(b, Model), bases): + return super(ModelBase, cls).__new__(cls, name, bases, attrs) # Create the class. new_class = type.__new__(cls, name, bases, {'__module__': attrs.pop('__module__')}) |
