mirror of
https://github.com/django/django.git
synced 2025-01-03 15:06:09 +00:00
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
This commit is contained in:
parent
83da190e40
commit
c27ba0b209
1
AUTHORS
1
AUTHORS
@ -149,6 +149,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
pgross@thoughtworks.com
|
pgross@thoughtworks.com
|
||||||
phaedo <http://phaedo.cx/>
|
phaedo <http://phaedo.cx/>
|
||||||
phil@produxion.net
|
phil@produxion.net
|
||||||
|
phil.h.smith@gmail.com
|
||||||
Gustavo Picon
|
Gustavo Picon
|
||||||
Luke Plant <http://lukeplant.me.uk/>
|
Luke Plant <http://lukeplant.me.uk/>
|
||||||
plisk
|
plisk
|
||||||
|
@ -22,8 +22,8 @@ class ModelBase(type):
|
|||||||
"Metaclass for all models"
|
"Metaclass for all models"
|
||||||
def __new__(cls, name, bases, attrs):
|
def __new__(cls, name, bases, attrs):
|
||||||
# If this isn't a subclass of Model, don't do anything special.
|
# If this isn't a subclass of Model, don't do anything special.
|
||||||
if not bases or bases == (object,):
|
if name == 'Model' or not filter(lambda b: issubclass(b, Model), bases):
|
||||||
return type.__new__(cls, name, bases, attrs)
|
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
|
||||||
|
|
||||||
# Create the class.
|
# Create the class.
|
||||||
new_class = type.__new__(cls, name, bases, {'__module__': attrs.pop('__module__')})
|
new_class = type.__new__(cls, name, bases, {'__module__': attrs.pop('__module__')})
|
||||||
|
Loading…
Reference in New Issue
Block a user