Ticket #6214: optimized.models.base.diff
File optimized.models.base.diff, 1.1 KB (added by , 17 years ago) |
---|
-
base.py
24 24 def __new__(cls, name, bases, attrs): 25 25 # If this isn't a subclass of Model, don't do anything special. 26 26 try: 27 if not filter(lambda b: issubclass(b, Model), bases): 27 parents = filter(lambda b: issubclass(b, Model), bases) 28 if not parents: 28 29 return super(ModelBase, cls).__new__(cls, name, bases, attrs) 29 30 except NameError: 30 31 # 'Model' isn't defined yet, meaning we're looking at Django's own … … 39 40 types.ClassType('MultipleObjectsReturned', (MultipleObjectsReturned, ), {})) 40 41 41 42 # Build complete list of parents 42 for base in bases: 43 # TODO: Checking for the presence of '_meta' is hackish. 44 if '_meta' in dir(base): 43 for base in parents: 44 if base is not Model: 45 45 new_class._meta.parents.append(base) 46 46 new_class._meta.parents.extend(base._meta.parents) 47 47