Code

Ticket #4050: base.py.4.diff

File base.py.4.diff, 714 bytes (added by Ludvig Ericson <ludvig.ericson@…>, 7 years ago)
Line 
1Index: django/db/models/base.py
2===================================================================
3--- django/db/models/base.py    (revision 5007)
4+++ django/db/models/base.py    (working copy)
5@@ -23,7 +23,10 @@
6     def __new__(cls, name, bases, attrs):
7         # If this isn't a subclass of Model, don't do anything special.
8         try:
9-            if not filter(lambda b: issubclass(b, Model), bases):
10+            for base in bases:
11+                if issubclass(base, Model):
12+                    break
13+            else:
14                 return super(ModelBase, cls).__new__(cls, name, bases, attrs)
15         except NameError:
16             # 'Model' isn't defined yet, meaning we're looking at Django's own